-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force rebuild on package.json changes #336
Conversation
// we want to rebuild the app and disregard the cached "module not found". | ||
// This custom plugin does the job. | ||
// Relevant issue: https://github.com/facebookincubator/create-react-app/issues/186 | ||
function RebuildOnPackageJSONChangePlugin(packageJsonPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to declare the plugin in a separate file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of, I wouldn't worry about this for now though. I don't want people to start depending on it or think it's a "best practice". Ideally we shouldn't need it because there should be a better way to fix this.
Maybe it is too simple to fully work in practice, but you could have a But that unfortunately requires the hook to always present in the |
👍 interested |
Okay, I have a better idea of what’s going on here. When you When you |
Yeah that makes a lot of sense. I guess an enhancement would be to add a few supporting "guesses" like "./src/index.js", "./src/main.js", "./src/", "./src/whateverisgenericenoughtoguess.js". If it adds to the experience (for the watching capabilities). But we wouldn't want to many empty watchers Id imagine. |
Is there any way to watch |
Partially fixes #186. I’m open to other solutions that don’t involve watching the whole
node_modules
or writing custom plugins.I think this is a step in the right direction because at least you don’t have to restart for the watcher to pick up the changes, you just have to
npm install --save
.This won’t help pick up updates you make by changing
package.json
and then runningnpm install
, but they didn’t work anyway (you currently have to restart).If there is a cheap way to watch for any changes to
node_modules
and purge the cache, we should probably do that instead.