Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: support tsconfig esmodule interop #785

Closed
wants to merge 4 commits into from
Closed

enhance: support tsconfig esmodule interop #785

wants to merge 4 commits into from

Conversation

huozhi
Copy link

@huozhi huozhi commented Jan 13, 2021

description

related to #531
when there's multiple exports in the source file while esModuleInterop specified as true in tsconfig compilerOptions, let rollup add __esModule: {value: true} mark to the output.

it will benefits the esmodule usage with the dist file when the dist is resolved to commonjs assets. the reason could be:

  • only main field is existed in package.json
  • due to some reason cjs assets is resolved instead of esmodule assets.

changes

  • respect esModuleInterop in tsconfig (for typescript source only)

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2021

⚠️ No Changeset found

Latest commit: bff8eb8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@wardpeet
Copy link
Collaborator

I wonder if we should add interop for non esm modules and look at rollup/rollup#3710 perhaps instead?

@huozhi
Copy link
Author

huozhi commented Mar 31, 2021

@wardpeet ty, I'll look for other ways to workaround

@huozhi huozhi closed this Mar 31, 2021
@huozhi huozhi deleted the ts-esm-interop branch March 31, 2021 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants