I was wondering if there was a way to watch some local folders and force _webpackHotDevClient_ to reload the page if a change happens. Either in _default_ mode or _ejected_ one. Thanks!
I agree this could be a useful feature, but how do we decide what to watch for changes? We'd want it to be configuration-less.
As for your local setup, you could put the npm run start behind nodemon and have it reboot the dev server for you on your specified changes. I believe it wouldn't require a manual page reload after if you're on OS X / Chrome.
This doesn't accomplish what you'd like, but will simulate it pretty well.
Can you clarify the use case? If something's in your dependency chain then refresh should already happen.
To be honest, I didn't think it will be a useful feature to be implemented in the library. I am just trying to find a solution to my specific problem. Putting the npm start behind nodemon, as suggested, seems to be a plausible solution. Will test later, thanks a lot!
I believe his use case, or at least what I assumed it to be, was for when the public/ folder changed. e.g. changing index.html, or anything in relation to https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#when-to-use-the-public-folder.
Ideally I鈥檇 like if we could do this automatically, but not sure how easy (or efficient) that would be.
I believe we could use chokidar to watch the public/ directory and tell our dev-server to reboot. I don't believe there'd be a large performance implication (no different than webpack currently watching files).
webpack-dev-server has built-in support for reloading files in the contentBase. Enable with watchContentBase: true in devServer object (see docs). Maybe you guys could use that? That feature is still a bit experimental, but it _should_ work (famous last words).
Oh that's awesome. Is it new to Webpack 2?
@gaearon jup! Let me know if the feature doesn't fit your needs, perhaps we can improve the feature a bit on the dev-server side.
Cool, that should be an easy PR.
Done! See #1546. Now that CRA has moved to webpack2 I will be using a forked version of create-react-app in our new company projects :).
Awesome 馃槃
I suspect it will take a little bit before we can cut 0.10 as we want to make a few more large changes at the same time, but we鈥檒l likely cut an alpha soon.
Please help beta test the new version that includes this change!
https://github.com/facebookincubator/create-react-app/issues/2172