- webpack配置
new HtmlWebpackPlugin({
inject: true,
minify: {
ignoreCustomFragments: [ /\${[a-zA-Z]*?}/],
},
template: paths.appHtml
}),
- html
<script>
var a="${a}";
var b="${b}";
</script>
- 报错
Template execution failed: ReferenceError: a is not defined
- 请问要怎么配置才能够让插件忽略
${}
看看这个文档: https://github.com/jantimon/h...
如果不指定模板引擎,默认使用 ejs 模板解析。
所以你需要强制使用 html 而禁用掉 ejs。