I am failing to set up Webpack with React HMR (and Babel). It seems to me that my setup is similar to the many examples I find here and there:
My package.json
dev depencencies:
{
// Only posting stuff that I think is relevant to this here
"babel-plugin-react-transform": "^2.0.2",
"babel-preset-react-hmre": "^1.1.1",
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"webpack": "^1.12.14",
"webpack-dev-middleware": "^1.5.1",
"webpack-dev-server": "^1.14.1",
"webpack-hot-middleware": "^2.10.0"
}
(Complete package.json
here)
And my babelrc
config
{
"presets": [
"es2015",
"react",
"stage-0",
"react-hmre"
],
"env": {
"development": {
"presets": ["react-hmre"]
}
}
}
My package.json
scripts:
{
"start": "NODE_ENV=development webpack-dev-server --hot --inline --config webpack.config.dev.js",
}
On my website nothing loads and I simply get an error
Uncaught Error: locals[0] does not appear to be a
module
object with Hot Module replacement API enabled. You should disable react-transform-hmr in production by usingenv
section in Babel configuration. See the example in README: https://github.com/gaearon/react-transform-hmr