Repository navigation
Closed
Copy link
Labels
area: optimizationTree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)Tree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)needs: reproductionNo runnable minimal reproduction yetNo runnable minimal reproduction yetregressionWorked in a previous release; pair with the Affected version fieldWorked in a previous release; pair with the Affected version field
Description
Have you used AI?
None
Which part of webpack is affected?
optimization (tree-shaking, splitChunks, concatenation)
Bug Description
After upgrading to webpack 5.111.1, my index.html with embedded JS started causing problems.
terser package, minify() function was called with with:
files: {
'index.html': ';(() => {
if (localStorage && window.matchMedia) {...'and
options: {
as: 'script'
ecma: 2020,
...
...then terser's defaults function throws an exception for as property:
if (croak) for (const i in ret) if (HOP(ret, i) && !HOP(defs, i)) {
throw new DefaultsError("`" + i + "` is not a supported option", defs);
}here's the call stack when minify is called:
minify(), bundle.min.js:34529
terserMinify(), 109:362
minify(), minify.js:407
renderEmbeddedSource(), minify.js:331
askEmbeddedRenderer(), dataURL.js:230
renderer(), 109:81
anonymous(), SourceProcessor.js:1094
processAsync(), SourceProcessor.js:1094
printDocument(), 109:107
minifyDocument(), 109:175
minimizer.implementation(), 109:177
minify(), minify.js:407
transform(), minify.js:454
execFunction(), threadChild.js:148
execHelper(), threadChild.js:127
execMethod(), threadChild.js:131
messageListener(), threadChild.js:49
[nodejs.internal.kHybridDispatch](), event_target:843
and where the worker throws an exception:
defaults(), bundle.min.js:78
minify_sync_or_async(), bundle.min.js:34269
minify(), bundle.min.js:34535
versions:
├─ html-webpack-plugin@npm:5.6.8 [e7565] (via npm:^5.6.8 [e7565])
│ └─ html-minifier-terser@npm:6.1.0 (via npm:^6.0.2)
│ └─ terser@npm:5.43.1 (via npm:^5.10.0)
└─ webpack@npm:5.111.1 [e7565] (via npm:^5.111.1 [e7565])
└─ minimizer-webpack-plugin@npm:5.8.0 [3db15] (via npm:^5.7.0 [3db15])
└─ terser@npm:5.51.2 (via npm:^5.51.0)
Link to Minimal Reproduction and steps to reproduce
Described in the description
Expected Behavior
webpack works correctly with terser and html files.
Actual Behavior
terser throws an exception about invalid as option.
Environment
⬡ System:
────────────────────────────────────────────────────────────────────────
OS: Linux 7.2 Fedora Linux 44 (Forty Four)
CPU: (16) x64 AMD Ryzen 7 PRO 7840HS w/ Radeon 780M Graphics
Memory: 41.96 GB / 61.43 GB
⬡ Binaries:
────────────────────────────────────────────────────────────────────────
Node: 24.18.0 - /usr/bin/node
Yarn: 4.18.0 - /usr/local/sbin/yarn
npm: 11.16.0 - /usr/bin/npmIs this a regression?
Yes (please specify version below)
Last Working Version
v5.110.3
Additional Context
No response
Reacted by Tadayoshi Sato
Metadata
Metadata
Assignees
Labels
area: optimizationTree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)Tree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)needs: reproductionNo runnable minimal reproduction yetNo runnable minimal reproduction yetregressionWorked in a previous release; pair with the Affected version fieldWorked in a previous release; pair with the Affected version field
Type
Fields
Priority
None yet
Effort
None yet
Activity
alexander-akait commentedon Sep 24, 2026
Please migrate to https://webpack.js.org/guides/native-html/, html-webpack-plugin is outdated
grgrzybek commentedon Sep 24, 2026
Thanks - I'll have a look. We also use Module Federation 1 (still), so it may take a while.
But I appreciate the hint ;)
fix: minify a `style=""` body as a rule's contents in every CSS minim…
fix: minify a `style=""` body as a rule's contents in every CSS minim…
alexander-akait commentedon Sep 24, 2026
@grgrzybek fixed in the minimizer-webpack-plugin, just update it locally, feel free create a new issue if your faced with issue(s) again
grgrzybek commentedon Sep 25, 2026
Thank you very much @alexander-akait ! works now with
It solves our problems.