无效的配置对象。 Webpack 已使用与 Angular V4.0.0 中的 API 模式 2 不匹配的配置对象初始化

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema 2 in Angular V4.0.0

我已经将 webpack 包更新到最新版本 2.3.2,我正在使用 Angular V4.0.0,typescript V2.2.2。运行 'npm run build' 命令时抛出以下错误。在更新它抛出错误后,它对 angular2 工作正常

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'htmlLoader'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: [
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           htmlLoader: ...
         }
       })
     ]

你应该移动 html 装载机

 htmlLoader: {
        minimize: false
    },


plugins: [
  new webpack.LoaderOptionsPlugin({
    options: {
      htmlLoader: {
       minimize: true
      }
    }
  })
]

看看这个link

在 webpack 2.0 中,他们已经停止支持直接加载自定义加载器。