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

Add module toStringTag to entries and interop namespaces #3822

Merged
merged 2 commits into from Oct 15, 2020

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #3760

Description

When using the output.namespaceToStringTag option, the "Module" tag will now be added to namespaces in the following situations:

  • internal inlined namespaces (this was working before)
  • entry chunks with exports that use named exports mode
  • namespaces imported via dynamic imports
  • external namespaces that were not ES modules but have been processed by an interop helper

Please have a look at the new tests for more details.

Moreover, this will now add the __esModule marker to exports of IIFE bundles as well (unless output.esModule is set to false).

@lukastaegert
Copy link
Member Author

@guybedford Would be nice if you could have a look at this.

@rollup-bot
Copy link
Collaborator

rollup-bot commented Oct 15, 2020

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#extend-module-tostringtag

or load it into the REPL:
https://rollupjs.org/repl/?circleci=13222

@codecov
Copy link

codecov bot commented Oct 15, 2020

Codecov Report

Merging #3822 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3822      +/-   ##
==========================================
+ Coverage   97.05%   97.06%   +0.01%     
==========================================
  Files         185      184       -1     
  Lines        6477     6500      +23     
  Branches     1873     1881       +8     
==========================================
+ Hits         6286     6309      +23     
  Misses        101      101              
  Partials       90       90              
Impacted Files Coverage Δ
src/Chunk.ts 100.00% <ø> (ø)
src/finalisers/index.ts 100.00% <ø> (ø)
src/finalisers/shared/getInteropBlock.ts 100.00% <ø> (ø)
src/finalisers/amd.ts 100.00% <100.00%> (ø)
src/finalisers/cjs.ts 100.00% <100.00%> (ø)
src/finalisers/iife.ts 100.00% <100.00%> (ø)
src/finalisers/shared/getExportBlock.ts 100.00% <100.00%> (ø)
src/finalisers/umd.ts 100.00% <100.00%> (ø)
src/utils/interopHelpers.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84e4e09...4c55efb. Read the comment docs.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for this fix.

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.

Output cjs chunk lost __esModule for es module.
3 participants