Skip to content

[CJS-ESM interop] Behavior of requiring ESM from CJS is different with @rollup/plugin-commonjs #1333

@haoqunjiang

Description

@haoqunjiang

Requiring ESM from CJS + TypeScript __importDefault helper results in a nested structure, all the exports of the ESM file are wrapped in the .default property of the required variable.

See https://github.com/sodatea/cjs-require-esm-tests.git for a minimal reproduction.

Rollup fixes this issue with rollup/plugins#552

It is also the cause of #1323

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions