GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DefaultsError: `as` is not a supported option with webpack 5.111.1 and terser 5.51.2 · Issue #22288 · webpack/webpack

DefaultsError: as is not a supported option with webpack 5.111.1 and terser 5.51.2 #22288

New issue
Copy link
New issue
Copy link
Closed
Bug
#22296
Closed
DefaultsError: as is not a supported option with webpack 5.111.1 and terser 5.51.2#22288
Bug
#22296
Copy link
Labels
area: optimizationTree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)needs: reproductionNo runnable minimal reproduction yetregressionWorked in a previous release; pair with the Affected version field

Description

@grgrzybek
grgrzybek
opened on Sep 24, 2026
Issue body actions

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/npm

Is this a regression?

Yes (please specify version below)

Last Working Version

v5.110.3

Additional Context

No response

Reacted by Tadayoshi Sato

Activity

  1. grgrzybek
    added the
    Bug
    issue type on Sep 24, 2026
  2. coderabbitai
    added
    area: optimizationTree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)
    needs: reproductionNo runnable minimal reproduction yet
    regressionWorked in a previous release; pair with the Affected version field
    on Sep 24, 2026
  3. alexander-akait commented on Sep 24, 2026

    @alexander-akait
    alexander-akait
    on Sep 24, 2026
    Member
    More actions

    Please migrate to https://webpack.js.org/guides/native-html/, html-webpack-plugin is outdated

  4. grgrzybek commented on Sep 24, 2026

    @grgrzybek
    grgrzybek
    on Sep 24, 2026
    Author
    More actions

    Please migrate to https://webpack.js.org/guides/native-html/, html-webpack-plugin is outdated

    Thanks - I'll have a look. We also use Module Federation 1 (still), so it may take a while.
    But I appreciate the hint ;)

    Reacted by Alexander Akait
  5. alexander-akait
    added 2 commits that reference this issue on Sep 24, 2026

    fix: minify a `style=""` body as a rule's contents in every CSS minim…

    1790f6f

    fix: minify a `style=""` body as a rule's contents in every CSS minim…

    ccb722d
  6. alexander-akait
    closed this as completedin #22296on Sep 24, 2026
  7. alexander-akait commented on Sep 24, 2026

    @alexander-akait
    alexander-akait
    on Sep 24, 2026
    Member
    More actions

    @grgrzybek fixed in the minimizer-webpack-plugin, just update it locally, feel free create a new issue if your faced with issue(s) again

  8. grgrzybek commented on Sep 25, 2026

    @grgrzybek
    grgrzybek
    on Sep 25, 2026
    Author
    More actions

    Thank you very much @alexander-akait ! works now with

    ➤ YN0085: │ + minimizer-webpack-plugin@npm:5.12.0
    ➤ YN0085: │ - minimizer-webpack-plugin@npm:5.8.0
    

    It solves our problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: optimizationTree-shaking, splitChunks, concatenation, ids (lib/optimize, lib/ids)needs: reproductionNo runnable minimal reproduction yetregressionWorked in a previous release; pair with the Affected version field

    Type

    Bug

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.