React 16开发+ webpack NODE_ENV

时间:2017-10-11 18:24:00

标签: javascript node.js webpack

我看到这是同样的问题,但对我没有解决方案。

我从CDN得到了反应,当我运行浏览器时,我发现错误。

enter image description here

在我的网站中是:

const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

    module.exports = {
      entry: {
        backend: ['babel-polyfill','./src/backend.js'],
      },
      output: {
        path: path.resolve(__dirname),
        filename: '[name].min.js'
      },
      externals: {
        'jQuery':'jQuery',
        'Foundation':'Foundation',
        'react': 'React',
        'react-dom': 'ReactDOM',
        'redux': 'Redux',
        'react-redux': 'ReactRedux',
        'immutable': 'Immutable',
        'lodash': '_',
        '_': '_'
      },
      module: {
        rules: [
          {
            test: /\.js$/,
            use: {
              loader: 'babel-loader',
              options: {
                "presets": [
                  "env",
                  "react",
                  "es2017",
                  "stage-3"
                ],
                "plugins": [["transform-class-properties", { "spec": true }],"transform-decorators-legacy"],
                "babelrc": false
              }
            }
          }
        ]
      },
      plugins: [
        new webpack.DefinePlugin({
            'process.env.NODE_ENV' : JSON.stringify('development')
        })
      ]
    }

我在mac OS上使用webpack 2.6.1,节点8.2.1

提前感谢任何提示。

0 个答案:

没有答案