如何避免反应缩小警告

时间:2017-02-17 09:19:58

标签: reactjs webpack

我几天都在遭受这个警告,并且不知道为什么这个配置不起作用。我已经添加了DefinePlugin,但是,我仍然得到了#34;警告:看起来你正在使用React的开发版本的缩小副本。"。

有关此问题的任何线索?谢谢!

的package.json

<Button
android:id="@+id/sign_in_button"
android:theme="@style/ButtonTheme"
//Other parameters as usual
/>

webpack.config.js

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "release":"NODE_ENV=production webpack",
   },
 "dependencies": {
    "react": "~15.0.1",
    "react-addons-css-transition-group": "~15.0.1",
    "react-bootstrap": "^0.29.5",
    "react-dom": "~15.0.1",
    "react-select-box": "^3.0.1"
  },
 "devDependencies": {
    "babel-core": "^6.4.5",
    "babel-loader": "^6.2.1",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "uglify-js-plugin": "0.0.6",
    "webpack": "^2.2.0"
  }
}

1 个答案:

答案 0 :(得分:0)

请在插件中使用以下配置

new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
      // Don't beautify output (enable for neater output)
      beautify: false,

      // Eliminate comments
      comments: false,

      // Compression specific options
      compress: {
        warnings: false,

        // Drop `console` statements
        drop_console: true
      },
    })