Describe the bug
Use htmlWebpackPluginTemplateCustomizer can't get HtmlWebpackPlugin.options.templateParameters value.
To Reproduce
Steps to reproduce the behavior:
const { htmlWebpackPluginTemplateCustomizer } = require('template-ejs-loader')
...
module.exports = {
...
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
templateParameters: {
test: 'This is a test',
fn(name) { return `This is a name ${name}`}
},
template: htmlWebpackPluginTemplateCustomizer({
templatePath:'./src/index.ejs' // ejs template path
htmlLoaderOption:{
// you can set individual html-loader option here.
// but preprocessor option is not supported.
},
templateEjsLoaderOption:{ // set individual template-ejs-loader option here
root:'', // this is for example, if not needed, just feel free to delete.
data:{ // example, too.
foo:'test' // btw, you can have indivisual data injection for each .ejs file using data option
}
}
}),
}),
]
...
}
Describe the bug Use
htmlWebpackPluginTemplateCustomizer
can't getHtmlWebpackPlugin.options.templateParameters
value.To Reproduce Steps to reproduce the behavior:
Expected behavior
Render:
Screenshots
Use
htmlWebpackPluginTemplateCustomizer
plugin.options.template
always return!${htmlLoader}${htmlLoaderOption}!${templateEjsLoader}${ejsLoaderOption}!${config.templatePath}
The initial configuration path of the template cannot be correct.
Additional context
Reserve the template path to the inline loaders option:
loader obtains the
currentPlugin
changes:This is my solution, welcome to exchange ideas.