0

I have a shared folder where reusable React components are stored. I want to make Hot Reload working with that directory, but it doesn't work. Here is the folder structure I have:

|__shared
|__src
|__package.json

Somehow Webpack HotModuleReplacement plugin is not triggering re-load when something is changing in a /shared folder? The entry in webpack.config looks like this:

entry: [
  "eventsource-polyfill",
  "webpack-hot-middleware/client?reload=true",
  path.join(process.cwd(), "src/app.js"),
]

Hot in the app:

  if (module.hot) {
    module.hot.accept('./reducers', () => {
      console.log('done')
    })
  }

The app is bootstrapped with react-boilerplate.

alex.mironov
  • 2,834
  • 6
  • 27
  • 41
  • I use `webpack-dev-server` for hot reloading. Do an `npm install` of the package and add a script like this to your `package.json` - `"dev": "webpack-dev-server --inline --hot"`. If you run `npm run dev` on your terminal, your app should update every time you make a change. – koolkat Aug 17 '17 at 18:03
  • Can you provide all code that is in app.js please? – GProst Aug 18 '17 at 06:53

0 Answers0