unbuild
unbuild copied to clipboard
Invalid stub file generated for modules using abitrary module namespace identifier names
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 (https://github.com/tc39/ecma262/pull/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) (https://github.com/nodejs/node/pull/53848).
Additional context
No response
Logs