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

(fix): correctly read tsconfig esModuleInterop #555

Merged
merged 1 commit into from
Mar 11, 2020

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Mar 10, 2020

  • it's a property of compilerOptions, not of overall tsconfig

    • i.e. tsconfig.compilerOptions.esModuleInterop
  • because this was incorrectly read, Rollup's esModule would always
    be set to undefined, and Rollup would then default to true

    • so esModuleInterop still wasn't being respected properly, I just
      shifted the defaults when I incorrectly patched this :/

(test): add tests for the default tsconfig as well as for when it's
explicitly set to false

Fixes #469 . Actually this was unintentionally fixed by me a short while ago when I updated #489 , but this improves the syntax and adds tests

This is a follow-up on bugs in #327

- it's a property of compilerOptions, not of overall tsconfig
  - i.e. tsconfig.compilerOptions.esModuleInterop

- because this was incorrectly read, Rollup's esModule would always
  be set to `undefined`, and Rollup would then default to `true`
  - so esModuleInterop still wasn't being respected properly, I just
    shifted the defaults when I incorrectly patched this :/

(test): add tests for the default tsconfig as well as for when it's
explicitly set to false
@agilgur5 agilgur5 force-pushed the fix-esmodule-undefined branch from deeb4fe to 3bdaca7 Compare March 11, 2020 00:08
@agilgur5
Copy link
Collaborator Author

agilgur5 commented Mar 11, 2020

Ok, so the test failures are very weird, because it even got true when there's no __esModule set in either dist/index.js or in the actual CJS files...

Like dist/, dist/index.js get __esModule as true somehow when dist/build-withtsconfig.cjs.production.min.js gets undefined...
That shouldn't be possible because dist/index.js sets its module.exports directly to the module.exports of the CJS file...

No one has complained about it being wrong since #367, nay, I even tested and use this in my own libraries... And I just manually confirmed the output is correct again in the default and false cases...

This might just be an artifact with how Jest loads these things 😕 🤷‍♂

Copy link
Collaborator Author

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the weird test failures that were happening before, LGTM

@agilgur5 agilgur5 merged commit c12f92c into jaredpalmer:master Mar 11, 2020
paul-vd pushed a commit to EezyQuote/tsdx that referenced this pull request Dec 1, 2020
- it's a property of compilerOptions, not of overall tsconfig
  - i.e. tsconfig.compilerOptions.esModuleInterop

- because this was incorrectly read, Rollup's esModule would always
  be set to `undefined`, and Rollup would then default to `true`
  - so esModuleInterop still wasn't being respected properly, I just
    shifted the defaults when I incorrectly patched this :/

(test): add tests for the default tsconfig as well as for when it's
explicitly set to false
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.

Esmodule options in rollup output is always undefined
1 participant