我正在尝试替换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.
你有什么想法是什么原因引起的或者如何进行调试吗?