javascript - React Hot Module Reloader preventing mocha tests from running -
i have react project running react-transform-hmr
hot module reloader, , running fine until implemented mocha tests. when run tests following error:
throw new error('locals[0] not appear
module
object hot module ' + 'replacement api enabled. should disable react-transform-hmr in ' + 'production usingenv
section in babel configuration. see ' + 'example in readme: https://github.com/gaearon/react-transform-hmr');
i have googled this, , found information mentioning moving hot module reloading setup out of .babelrc
file , webpack config, did, , tests ran fine, hot module reloading wasn't working.
after playing around, , not getting both work together, have reverted , thought ask stuck. ideas can do?
my babel config follows:
{ "presets": ["react", "es2015", "stage-1"], "env": { "development": { "plugins": [ ["transform-object-rest-spread"], ["transform-react-display-name"], ["react-transform", { "transforms": [{ "transform": "react-transform-hmr", "imports": ["react"], "locals": ["module"] }, { "transform": "react-transform-catch-errors", "imports": ["react", "redbox-react"] }] }] ] }, "production": { "plugins": [ ["transform-object-rest-spread"], ["transform-react-display-name"] ] } } }
and webpack config follows:
module: { loaders: [ // js { test: /\.js$/, loaders: ['babel'], include: path.join(__dirname, 'client') } ] }
thank :)
got working following in package.json:
"test": "export node_env=testing|| set node_env=testing&& mocha --compilers js:babel-core/register --require ./tests/test-helper.js \"./tests/**/*@(.js|.jsx)\"",
this taken here.
Comments
Post a Comment