如何停止Webpack缩小HTML?

Dan*_*Dan 4 webpack

我已经阅读了Webpack文档一部分,部分解释了为什么Webpack在使用module.loaders语法设置加载程序时会缩小HTML 。但是我找不到任何地方可以解释如何停止这种情况。我正在使用pug-loaderhtml-webpack-plugin处理我的模板,但是Webpack总是使用缩小的HTML来将它们吐出来。

我该如何阻止呢?

{
  test: /\.pug$/,
  use: 'pug-loader'
}

new HtmlWebpackPlugin({
  title: 'Home',
  filename: 'index.html',
  template: './src/index.pug',
  inject: 'head',
  chunks: ['app'],
  hash: true
}),
Run Code Online (Sandbox Code Playgroud)

bla*_*ool 6

这个问题可能对您有帮助。

loaders: [
    {
      test: /\.pug$/,
      exclude: /(node_modules)/,
      loader: "pug-html",
      query: {
        pretty: true
      }
    }
  ]
Run Code Online (Sandbox Code Playgroud)


imj*_*red 5

html-webpack-plugin 有一个选项。minify: false. 你试过添加吗?

https://github.com/jantimon/html-webpack-plugin#configuration