Open chenjiahan opened 4 weeks ago
This is required for ESM import in node:
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
example
});
Ref:
I think we're aligned with esbuild's behavior?
async function main() {
const thing = await import('./dist/index.cjs')
console.log(thing, thing.example)
}
Checked by manually copy to the dist.
esbuild:
rslib:
@fi3ework --platform=node
is required for esbuild
Version
System: OS: macOS 14.6.1 CPU: (16) arm64 Apple M3 Max Memory: 8.00 GB / 64.00 GB Shell: 5.9 - /bin/zsh Browsers: Chrome: 130.0.6723.71 Safari: 17.6 npmPackages: @rslib/core: ^0.0.15 => 0.0.15
Details
test.mjs
file to import() the dist bundle:Reproduce link
https://github.com/chenjiahan/rslib-repro-cjs-export
Reproduce Steps
Rslib:
tsup: