How to make html-webpack-plugin not execute the ejs statement of the template, but leave it as it is?

if there is an ejs sentence in my template file

new HtmlWebpackPlugin({
  filename: "../views/index.html",
  template: "./src/templates/index.html"
})

if you execute it directly, you will get an error ReferenceError: user is not defined

.

but I think html-webpack-plugin doesn"t execute the ejs statement in template, but keeps the output as it is.

so how can I keep the output as it is?


  

do you want to cancel the ejs template feature that comes with html-webpack-plugin?
you can try using html-loader
demo: {test:/.html/, loader:'html-loader'} / / of course, other module loaders can also
and then the plug-in template uses .html as the suffix
new HtmlWebpackPlugin ({template: 'xxx.html', filename:' xxx.html'})
so that your .html will be handed over to html-loader instead of using the default ejs processing

Menu