You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 5.6.0, a reference to htmlWebpackPlugin.options.filename within a template file contains the the token [name]. It has not been replaced with the actual filename. In my case, it is ../../Pages/Shared/Bundles/[name].cshtml
Expected behaviour ☀️
In version 5.5.0, the reference has had the [name] token replaced with the filename: ../../Pages/Shared/Bundles/style.cshtml
Reproduction Example 👾
With version 5.6.0 and the configuration below, webpack generates the files main.cshtml, style.cshtml and validation.cshtml, but they are empty. Reverting to version 5.5.0 produces correct contents.
<%
//get bundle file we're currently building. eg site.cshtml
var pathParts = _.split(htmlWebpackPlugin.options.filename, '/')
var file = pathParts[_.size(pathParts)-1]
var fileParts = _.split(file, '.')
var curFile = fileParts[0]
//only show chunks that match current bundle file we're building
var chunkFile = ''
for (var chunk in htmlWebpackPlugin.tags.headTags) {
var tempChunk = _.replace(htmlWebpackPlugin.tags.headTags[chunk], '</script>', '')
var pathPartsChunk = _.split(tempChunk, '/') // htmlWebpackPlugin.tags.headTags[chunk], '/')
var fileChunk = pathPartsChunk[_.size(pathPartsChunk)-1]
var filePartsChunk = _.split(fileChunk, '.')
var curChunkFile = filePartsChunk[0]
if (curChunkFile == curFile) {
chunkFile = htmlWebpackPlugin.tags.headTags[chunk]
}
}
%><%=chunkFile%>
Current behaviour 💣
In version 5.6.0, a reference to
htmlWebpackPlugin.options.filename
within a template file contains the the token[name]
. It has not been replaced with the actual filename. In my case, it is../../Pages/Shared/Bundles/[name].cshtml
Expected behaviour ☀️
In version 5.5.0, the reference has had the
[name]
token replaced with the filename:../../Pages/Shared/Bundles/style.cshtml
Reproduction Example 👾
With version 5.6.0 and the configuration below, webpack generates the files
main.cshtml
,style.cshtml
andvalidation.cshtml
, but they are empty. Reverting to version 5.5.0 produces correct contents.webpack.config.js:
bundletemplate.ejs
Environment 🖥
Node.js v18.16.0
win32 10.0.19045
Waiting for the debugger to disconnect...
9.5.1
website@1.0.0 C:\sandbox\UOE.WebsiteTemplates\content\UOE.Bootstrap5.Razor
├─┬ clean-webpack-plugin@4.0.0
│ └── webpack@5.91.0 deduped
├─┬ css-loader@7.1.1
│ └── webpack@5.91.0 deduped
├─┬ css-minimizer-webpack-plugin@6.0.0
│ └── webpack@5.91.0 deduped
├─┬ html-webpack-plugin@5.6.0
│ └── webpack@5.91.0 deduped
├─┬ mini-css-extract-plugin@2.9.0
│ └── webpack@5.91.0 deduped
├─┬ postcss-loader@8.1.1
│ └── webpack@5.91.0 deduped
├─┬ sass-loader@14.2.1
│ └── webpack@5.91.0 deduped
├─┬ style-loader@4.0.0
│ └── webpack@5.91.0 deduped
├─┬ ts-loader@9.5.1
│ └── webpack@5.91.0 deduped
├─┬ webpack-cli@5.1.4
│ ├─┬ @webpack-cli/configtest@2.1.1
│ │ └── webpack@5.91.0 deduped
│ ├─┬ @webpack-cli/info@2.0.2
│ │ └── webpack@5.91.0 deduped
│ ├─┬ @webpack-cli/serve@2.0.5
│ │ └── webpack@5.91.0 deduped
│ └── webpack@5.91.0 deduped
└─┬ webpack@5.91.0
└─┬ terser-webpack-plugin@5.3.10
└── webpack@5.91.0 deduped
website@1.0.0 C:\sandbox\UOE.WebsiteTemplates\content\UOE.Bootstrap5.Razor
└── html-webpack-plugin@5.6.0
The text was updated successfully, but these errors were encountered: