From 550f8eafcbcc32db127fa2a22bebe9d6b7dff3ba Mon Sep 17 00:00:00 2001 From: Purcea Robert Date: Mon, 17 Sep 2018 19:44:28 +0300 Subject: [PATCH] fixed watch not working when NODE_ENV is production (#2024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- name: 🙋 fix for watch not working when NODE_ENV is 'production' about: fixes issue #2011 --- ## ↪️ Pull Request I understand that Parcel should watch changes every time the watch command is being used. Previously, watch was enabled on dev environment only, while the watch command inserted by users was completely ignored. With this modification, watch is always enabled if the user passes the command in CLI. ## 💻 Examples There is an example in #2011 - first post ## ✔️ PR Todo - [ ] Added/updated unit tests for this change - [ ] Filled out test instructions - [ ] Included links to related issues/PRs --- src/cli.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cli.js b/src/cli.js index 837efdf8728..4e2ff4ce825 100755 --- a/src/cli.js +++ b/src/cli.js @@ -188,6 +188,10 @@ async function bundle(main, command) { // Require bundler here so the help command is fast const Bundler = require('../'); + if (command.name() === 'watch') { + command.watch = true; + } + if (command.name() === 'build') { command.production = true; process.env.NODE_ENV = process.env.NODE_ENV || 'production';