【发布时间】:2016-11-16 12:33:22
【问题描述】:
我正在尝试替换 index.html 中如下所示的变量:
<meta name='author' content=$variable>
在我使用的配置文件中:
{
test: /index\.html$/,
loader: 'string-replace',
query: {
search: '$variable',
replace: 'stuff to inject',
},
}
在loaders数组中,然后在plugins中:
new HtmlWebpackPlugin({
template: conf.path.src('src/index.html'),
inject: true,
})
但是这个设置会导致:
ERROR in ./~/html-webpack-plugin/lib/loader.js!./src/index.html
Module parse failed (...) Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
您是否知道这可能是由什么引起的,或者我该如何调试?
【问题讨论】:
-
为了调试,我使用iron-node,它允许将调试器语句添加到节点模块
标签: javascript html build webpack webpack-html-loader