webpack打包遇到locals[0] does not appear to be a `module` object with Hot Module replacement API enabled
Posted webxzy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webpack打包遇到locals[0] does not appear to be a `module` object with Hot Module replacement API enabled相关的知识,希望对你有一定的参考价值。
解决办法:
1.删除.bablerc文件的env下的"development": {"presets": ["react-hmre"]}
2.在webpack.config的loader添加以下代码
module: { loaders: [ { test: /\.(js|jsx)$/, loader: ‘babel‘, include: path.join(__dirname, ‘src‘), query: { plugins: [ ["react-transform", { transforms: [{ transform: "react-transform-hmr", imports: ["react"], locals: ["module"] }, { "transform": "react-transform-catch-errors", "imports": ["react", "redbox-react"] }] }] ] } } ] }
以上是关于webpack打包遇到locals[0] does not appear to be a `module` object with Hot Module replacement API enabled的主要内容,如果未能解决你的问题,请参考以下文章
Webpack + Vue 多页面项目升级 Webpack 4 以及打包优化
从0开始的TypeScriptの五:webpack打包typescript