Webpack 第4页-->;配置[0]具有未知属性';优化';

Webpack 第4页-->;配置[0]具有未知属性';优化';,webpack,Webpack,我正在使用webpack@4.8.1,当我运行它时。我得到这个错误: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration[0] has an unknown property 'optimization'. These properties are valid:

我正在使用webpack@4.8.1,当我运行它时。我得到这个错误:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration[0] has an unknown property 'optimization'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
我猜这与Webpack4有关。我想我要么忘了什么,要么我没有安装可能需要的依赖包。但也不完全确定。 这是我的webpack.config.js文件:

const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');

module.exports = {
  entry: slsw.lib.entries,
  target: 'node',
  // Generate sourcemaps for proper error messages
  devtool: 'source-map',
  // Since 'aws-sdk' is not compatible with webpack,
  // we exclude all node dependencies
  externals: [nodeExternals()],
  mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
  optimization: {
    // We no not want to minimize our code.
    minimize: false
  },
  performance: {
    // Turn off size warnings for entry points
    hints: false
  },
  // Run babel on all .js files and skip those in node_modules
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: __dirname,
        exclude: /node_modules/
      }
    ]
  }
};

您使用的是哪个版本的无服务器网页包?我遇到了同样的问题,升级到无服务器-webpack@latest(5.x)它又开始工作了。似乎帮我修好了。谢谢@DavidC&Taylor Austin-这是否可以作为公认的答案添加?