Skip to content

When output.module is true: Cannot read properties of undefined (reading 'arguments') #684

Closed

Description

@gian1200

Bug Description

Following #409, when building a project with ESM, the following error appears:

Error parsing bundle asset "<redacted>\dist\public\index.mjs": Cannot read properties of undefined (reading 'arguments') {
  cause: TypeError: Cannot read properties of undefined (reading 'arguments')
      at getModulesLocations (<redacted>\node_modules\webpack-bundle-analyzer\lib\parseUtils.js:236:24)
      at Object.ExpressionStatement (<redacted>\node_modules\webpack-bundle-analyzer\lib\parseUtils.js:43:35)
      at c (<redacted>\node_modules\acorn-walk\dist\walk.js:58:37)
      at Object.skipThrough (<redacted>\node_modules\acorn-walk\dist\walk.js:186:39)
      at c (<redacted>\node_modules\acorn-walk\dist\walk.js:58:37)
      at base.Program.base.BlockStatement.base.StaticBlock (<redacted>\node_modules\acorn-walk\dist\walk.js:198:7)
      at base.Program.base.BlockStatement.base.StaticBlock (<redacted>\node_modules\acorn-walk\dist\walk.js:198:7)
      at c (<redacted>\node_modules\acorn-walk\dist\walk.js:58:37)
      at Object.recursive (<redacted>\node_modules\acorn-walk\dist\walk.js:59:7)
      at parseBundle (<redacted>\node_modules\webpack-bundle-analyzer\lib\parseUtils.js:25:8)
      at Object.getViewerData (<redacted>\node_modules\webpack-bundle-analyzer\lib\analyzer.js:80:22)
}

Link to Minimal Reproduction and step to reproduce

https://github.com/gian1200/webpack-bundle-analyzer-reproducer-409

Steps:

  1. Run 'npm install'
  2. Run 'npm run build'
  3. See error in console

If experiments.outputModule and output.module are commented (from .config\webpack.common.mjs), then there is no error

Expected Behavior

Clean build

Actual Behavior

Error in console

Environment

System:
    OS: Windows 11 10.0.26200
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
    Memory: 1.98 GB / 15.71 GB
  Binaries:
    Node: 24.11.1 - C:\nvm4w\nodejs\node.EXE
    npm: 11.6.2 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Chrome: 143.0.7499.42
    Edge: Chromium (140.0.3485.54)
    Internet Explorer: 11.0.26100.7309
  Packages:
    webpack: ^5.103.0 => 5.103.0 
    webpack-bundle-analyzer: ^5.1.0 => 5.1.0 
    webpack-cli: ^6.0.1 => 6.0.1 
    webpack-merge: ^6.0.1 => 6.0.1

Is this a regression?

No

Last Working Version

No response

Additional Context

No response

Activity

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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions