webpack打包遇到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 using `env` section in Babel configuration
2016-11-22 23:03
976 查看
解决办法:
1.删除.bablerc文件的env下的"development": {"presets": ["react-hmre"]}
2.在webpack.config的loader添加以下代码
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"] }] }] ] } } ] }
相关文章推荐
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- 使用cocapods报错 [!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes
- The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid
- EF之数据库连接问题The specified named connection is either not found in the configuration, not intended to be used with the Ent
- - Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- [Centos] mod_wsgi 安装流程以及遇到问题解决办法。apxs: command not found 或 Sorry, Python developer package does not appear to be installed.
- Webpack 2 视频教程 020 - Webpack 2 中的 HMR ( Hot Module Replacement )
- ubuntu下gedit闪退,遇到问题:ERROR:../../gi/pygi-argument.c:1583:_pygi_argument_to_object: code should not be reached 已放弃 (核心已转储)
- webpack 升级Getting error: configuration.resolve.extensions[0] should not be empty
- How do disable paging by swiping with finger in ViewPager but still be able to swipe programmatically?
- JVM装MAC时遇到的一个问题(Mac OS X is not supported with binary translation. To run Mac OS X you need a host )
- Visual Studio 2010 发布Web项目提示The target "PipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.解决方法
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in
- You should not be calling AfxGetMainWnd in a worker thread
- How to monitor Web server performance by using counter logs in System Monitor in IIS
- Can not deploy web module to applications of weblogic in eclipse.
- Introduction to using Java Persistence API in a web application in Java EE environment
- Export DWG with ObjectData to ESRI shape file using AutoCAD Map 3D API
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API