In HtmlWebpackPlugin configurations when I specify templateParameters I no longer have access to my files in the template.
Webpack Config:
plugins: [
new HtmlWebpackPlugin({
template: './app/index.ejs',
inject: false,
templateParameters: configJSON
})
],
Template:
<script src="<%= htmlWebpackPlugin.files.js[0] %>"></script>
Is there a way to access files while using templateParameters?
Looked over the source code and found that templateParameters
can also be a function and has the parameters compilation
, assets
, options
. The assets parameter has all the files. The object returned from this function will be the templateParameters
.