Skip to content

Commit

Permalink
fixed watch not working when NODE_ENV is production (#2024)
Browse files Browse the repository at this point in the history
---
name: πŸ™‹ fix for watch not working when NODE_ENV is 'production'
about: fixes issue #2011 
---

<!---
Thanks for filing a pull request πŸ˜„ ! Before you submit, please read the following:

Search open/closed issues before submitting since someone might have pushed the same thing before!
-->
## β†ͺ️ Pull Request
<!---
Provide a general summary of the pull request here
Does this address an existing issue?
-->
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
<!-- Love parcel? Please consider supporting our collective:
πŸ‘‰  https://opencollective.com/parcel/donate -->
  • Loading branch information
RobertPurcea authored and DeMoorJasper committed Sep 17, 2018
1 parent ca91bfe commit 550f8ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cli.js
Expand Up @@ -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';
Expand Down

0 comments on commit 550f8ea

Please sign in to comment.