From a9e2fccd63e158801f059ac8f162c833356b69e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 18 Apr 2019 08:29:22 +0200 Subject: [PATCH] Fix npm dev build instructions --- developer_manual/app/npm.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/developer_manual/app/npm.rst b/developer_manual/app/npm.rst index 19305a7c9..0442e3f31 100644 --- a/developer_manual/app/npm.rst +++ b/developer_manual/app/npm.rst @@ -23,7 +23,7 @@ For apps that use webpack, this might look like this: { "name": "myapp", "scripts": { - "build": "webpack --progress --config webpack.prod.js" + "build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js" }, "devDependencies": { "webpack": "^4.26.1", @@ -35,22 +35,23 @@ You can then run ``npm build`` in your app's root directory to invoke the build See the `npm-build docs https://docs.npmjs.com/cli/build`_ for more info. -npm run watch -------------- +npm run dev, npm run watch +-------------------------- Since building the release version of JavaScript scripts can be slow, apps often have a dedicated -build step for development that builds faster and enables debug output. Additionally, it instructs +build step for development that builds faster and enables debug output. Additionally, it can instructs the bundler to listen to file changes and (incrementally) rebuild the project. -This command should be added to ``package.json`` as ``watch`` script: +This command should be added to ``package.json`` as ``dev`` and ``watch`` script: .. code-block:: json { "name": "myapp", "scripts": { - "build": "webpack --progress --config webpack.prod.js", - "watch": "webpack --progress --config webpack.dev.js --watch" + "build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.prod.js", + "dev": "NODE_ENV=development webpack --progress --config webpack.dev.js", + "watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.js" }, "devDependencies": { "webpack": "^4.26.1", @@ -58,7 +59,7 @@ This command should be added to ``package.json`` as ``watch`` script: } } -The development build is invoked with ``npm run dev``. +The development build is invoked with ``npm run dev`` or if you want to leave the process running and update on every change made to the source files, ``npm run watch``. npm test --------