2017-06-14 68 views
1

我已阅读part of the Webpack documentation,它解释了为什么在使用module.loaders语法设置加载程序时,Webpack将缩小HTML的大小。但是我找不到解释如何阻止这一点的任何地方。我正在使用pug-loaderhtml-webpack-plugin来处理我的模板,但是Webpack总是将它们与HTML缩小混在一起。如何停止Webpack缩小HTML?

我该如何解决这个问题?

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

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

回答

3

This issue可以帮助你。

loaders: [ 
    { 
     test: /\.pug$/, 
     exclude: /(node_modules)/, 
     loader: "pug-html", 
     query: { 
     pretty: true 
     } 
    } 
    ] 
+0

这是使用'pug-html-loader'插件。 –

+0

虽然这个选项也适用于'pug-loader'并且可以工作,所以谢谢! –