react,webpack开发中遇到的一些问题

1,warning.js:33 Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See fb.me/react-minif… for more details.
warning.js:14 You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (github.com/zertosh/loo…) for browserify or DefinePlugin for webpack (stackoverflow.com/questions/3…) to ensure you have the correct code for your production build.

解决方法:

在plugins里面添加:

new webpack.DefinePlugin({
    'process.env': {
        NODE_ENV: JSON.stringify('production'),
    },
})
复制代码
2,打包的时候出现 Refused to apply style from 'http://0.0.0.0:2003/loader.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

解决方法:

有可能在package.json里面build里面执行的文件不对,build里面引入了webpack.production.config.js,而不是webpack.config.js,开发环境和生产环境的问题,具体要看自己的环境再做决定。

3,React-Hot-Loaded is not supported in this environment.

解决方法:

production环境js压缩去掉。

  // JS压缩
  // new webpack.optimize.UglifyJsPlugin({
  //   compress: {
  //     warnings: false,
  //   } }
  // )
复制代码
4,warning.js:14 You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (github.com/zertosh/loo…) for browserify or DefinePlugin for webpack (stackoverflow.com/questions/3…) to ensure you have the correct code for your production build.

解决方法:

这是Nodejs开发环境和生产环境问题 , webpack.config.js加上

new webpack.DefinePlugin({
    'process.env': {
      NODE_ENV: JSON.stringify('production'),
    },
  })
复制代码
5,运行太慢 ,运行到了78%就出现additional chunk assets不动了 .

解决方法:

const BPlugin = require('babili-webpack-plugin’);
babili-webpack-plugin之类的插件去掉。

6,Uncaught RangeError: Maximum call stack size exceeded .

解决方法:

在package.json里的script里使用了--hot和在webpack.config.js里调用了HotModuleReplacementPlugin,最后把webpack.config.js里的HotModuleReplacementPlugin去掉就好了,用了package.json —hot之后就不需要用react-hot-loader了,不然会报react-hot-loader enabled的错误。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值