Skip to content

Invalid stub file generated for modules using abitrary module namespace identifier names #533

@sapphi-red

Description

@sapphi-red

Environment

Node 22.15.0
unbuild 3.4.0

Reproduction

https://stackblitz.com/edit/node-eufscqik?file=index.ts&terminal=dev

Describe the bug

For a module using arbitrary module namespace identifier names feature (tc39/ecma262#2154), unbuild generates a stub file that is not valid.
An example of the output is:

export const 'module.exports' = _module.'module.exports';

This feature is used for module.exports export feature as a part of require(esm) (nodejs/node#53848).

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions