Webpack 4.将“模式”选项设置为“开发”或“生产”以启用该环境的默认设置

时间:2018-06-23 08:30:43

标签: webpack webpack-dev-server webpack-4 webpack-3

从webpack 3更新到webpack 4版本后,我已经开始从webpack接收错误-

WARNING in configuration The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.

我当前的配置如下所示。我怎么了?

config.globals = {
  'process.env': {
    NODE_ENV: JSON.stringify(config.env)
  },
  NODE_ENV: config.env,
  __DEV__: config.env === 'development',
  __PROD__: config.env === 'production',
  __TEST__: config.env === 'test',
  __BASENAME__: JSON.stringify(process.env.BASENAME || '')
}

0 个答案:

没有答案