Skip to content

Collision with global variables when optimization.avoidEntryIife = true #18843

@dmichon-msft

Description

@dmichon-msft

Bug report

What is the current behavior?
When an entry module contains a local override of const Symbol = 'Symbol' and the compilation contains the runtime module makeNamespaceObject (i.e. __webpack_require__.r), the scope analysis doesn't rename the shadowing Symbol variable and results in the global Symbol in the runtime module being replaced with the local variable.

If the current behavior is a bug, please provide the steps to reproduce.

Have an entry module that shadows the global Symbol.
Require the makeNamespaceObject (__webpack_require__.r) runtime module.

What is the expected behavior?

Entry modules need to rename any globals that they shadow if optmization.avoidEntryIife = true.

Other relevant information:
webpack version: 5.95.0
Node.js version: 18.19.1
Operating System: Linux
Additional tools:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions