网页包4:<;%=htmlWebpackPlugin.options.title%>;没有得到价值
根据这一理论: 如果向html网页插件选项添加标题选项,如下所示:网页包4:<;%=htmlWebpackPlugin.options.title%>;没有得到价值,webpack,title,Webpack,Title,根据这一理论: 如果向html网页插件选项添加标题选项,如下所示: new HtmlWebPackPlugin({ template: './src/index.html', filename: './index.html', title: 'My App', }), 并将以下代码段添加到HTML模板中 <title><%= htmlWebpackPlugin.options.title %></title> 它应该从插件设置中获取标题值
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html',
title: 'My App',
}),
并将以下代码段添加到HTML模板中
<title><%= htmlWebpackPlugin.options.title %></title>
它应该从插件设置中获取标题值,并将其显示在标题标签中
但是,
似乎没有获取值!可能是Webpack 4中不推荐使用此功能吗?我从Webpack.config.js中删除了html加载程序。
然后,它就像一个符咒
问候@user1941537
安装以下依赖项:
npm install -D --safe-dev ejs-loader extract-loader
并添加.html文件的规则,如下所示
rules:[{
test: /\.html$/,
use: ['ejs-loader', 'extract-loader', 'html-loader']
}]
有人能确认吗?ejs加载器是不必要的。该模板只有一个.html文件。