Open snoleo opened 4 years ago
I suggest to support htmlWebpackPlugin.options in the ejs templates: -- webpack.conf.js --
webpack.conf.js
module: { rules: [ { test: /\.ejs$/i, use: [ { loader: 'html-loader', options: { minimize: false, esModule: false } }, { loader: 'ejs-plain-loader' } ] } ] }, plugins: [ new HtmlWebpackPlugin({ chunks: ['outputA'], template: './template.ejs', filename: './output.html', title: 'Output Page Title', meta: { 'keywords': 'aaa,bbb', 'description': 'webpage descriptions' } }) ]
-- template.ejs --
template.ejs
<title><%= htmlWebpackPlugin.options.title %></title>
should generate html:
<title>Output Page Title</title> <meta name="keywords" content="aaa,bbb"> <meta name="description" content="webpage descriptions">
I encountered the same problem☹️
You can try : https://github.com/snoleo/ejs-easy-loader
I suggest to support htmlWebpackPlugin.options in the ejs templates: --
webpack.conf.js
----
template.ejs
--should generate html: