我读过part of the Webpack documentation,它解释了为什么在使用module.loaders语法设置加载器时,Webpack会缩小超文本标记语言。但我找不到任何地方能解释如何阻止这一切。我正在使用pug-loader和html-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
}),发布于 2017-06-23 20:16:11
This issue可能会对您有所帮助。
loaders: [
{
test: /\.pug$/,
exclude: /(node_modules)/,
loader: "pug-html",
query: {
pretty: true
}
}
]发布于 2017-06-14 22:32:50
有一个用于html-webpack-plugin的选项。minify: false。你试过添加这个吗?
https://github.com/jantimon/html-webpack-plugin#configuration
发布于 2019-01-15 16:24:56
下面的命令既适用于npm run dev,也适用于npm run prod
module: {
rules: [{
test: /\.pug$/,
use: [
'html-loader?minimize=false',
'pug-html-loader?pretty=true'
]
}]
},https://stackoverflow.com/questions/44547649
复制相似问题