1
votes

I'm adding react-hot-loader into my project. My project uses webpack2, babel7, react-hot-loader3 and webpack-dev-server. I got a "regeneratorRuntime is not defined" error when start the app. I use this boilerplate as a sample. I'm not using the code below, because my configureStore is external, I don't have the access of my combined reducers(the store had applied redux-saga middleware).

if (module.hot) {
        module.hot.accept('../reducer', () =>
            store.replaceReducer(require('../reducer')) // eslint-disable-line global-require
        );
    }

As I know, regeneratorRuntime is what babel to compile generator from es6 which is used by redux-saga, does this matter? How should I do when I couldn't make the store internal and can't access the reducers.

1

1 Answers

0
votes

You need to use babel-plugin-transform-runtime.

$ npm install --save-dev babel-plugin-transform-runtime
$ npm install --save babel-runtime

In .babelrc, add the runtime plugin:

{
  "plugins": [
    ["transform-runtime", {
      "polyfill": false,
      "regenerator": true
    }]
  ]
}