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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a module exports condition #152

Closed
wants to merge 1 commit into from

Conversation

Andarist
Copy link
Contributor

This would allow bundlers to "deduplicate" those:

// in pkg-a
import tinyInvariant from 'tiny-invariant'
// in pkg-b
const tinyInvariant = require('tiny-invariant')

Without this condition, 2 copies of tiny-invariant have to be loaded/bundled.

Isn't the JS ecosystem just great? 馃ぃ

@alexreardon
Copy link
Owner

I'll aim to ship this tomorrow

@Andarist
Copy link
Contributor Author

I actually forgot here that you are exports: 'auto' here with Rollup, so... this change would not be quite OK as bundlers would assume that there your library is supposed to be accessed through.default in CJS. So this can't be merged - if one manages to load tiny-invariant from two different module systems then they will just load 2 different modules.

@Andarist Andarist closed this Sep 28, 2022
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

2 participants