dc7290 / template-ejs-loader

ejs-loader with webpack5 support. Chain it to html-loader and use it with html-webpack-plugin.
MIT License
24 stars 3 forks source link

About the value of `htmlWebpackPlugin` #23

Open dc7290 opened 2 years ago

dc7290 commented 2 years ago

Problems with this loader

Currently, the loader cannot use htmlWebpackPlugin values in ejs files. It cannot simply use the data in individual files, but also the values provided by default by html-webpack-plugin.

Message

I would like to solve this problem, but I am not sure how to make it possible. I would appreciate help from anyone who knows how to solve this.

Reference information

For reference, I will list the values of htmlWebpackPlugin for the various loaders that can be used and those that cannot. Based on these, we would like to find the conditions under which the htmlWebpackPlugin value can be used in a file.

Loaders for which the value of htmlWebpackPlugin can be used

Loaders for which the value of htmlWebpackPlugin is not available

Supplementary information

Also add the expected conditions under which this value will be available in the file.

tstibbs commented 1 year ago

This plugin looks useful but this problem prevented me from using it, so definitely a +1 for this feature from me.

For anyone wondering about a workaround, I ended up not using this plugin at all and just calling the EJS module directly, passing in htmlWebpackPlugin as one of the template variables, and then passed the rendered template to templateContent in HtmlWebpackPlugin.