Skip to content

fix(@formatjs/fast-memoize)!: use named exports#4030

Merged
pyrocat101 merged 1 commit intomainfrom
fast-memoize
Mar 19, 2023
Merged

fix(@formatjs/fast-memoize)!: use named exports#4030
pyrocat101 merged 1 commit intomainfrom
fast-memoize

Conversation

@pyrocat101
Copy link
Member

@pyrocat101 pyrocat101 commented Mar 19, 2023

Fixes #3999

BREAKING CHANGE: memoize is now a named exports rather than a default exporst to workaround shenaginans of bundler compatibility.

@pyrocat101 pyrocat101 changed the title fix!(@formatjs/fast-memoize): use named exports fix(@formatjs/fast-memoize)!: use named exports Mar 19, 2023
@pyrocat101 pyrocat101 merged commit 3d64e6a into main Mar 19, 2023
@pyrocat101 pyrocat101 deleted the fast-memoize branch March 19, 2023 04:27
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"exports": {
"import": "./lib/index.js",

Choose a reason for hiding this comment

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

This breaks native ESM support. When using a native import, it resolves to this export condition. This export condition resolves to a .js file. Because this package.json doesn’t specify "type": "module", this file is treated as CJS. However, it contains ESM syntax, which is a syntax error.

To fix this, this file should have a .mjs file extension. The accompanying type definitions should use a .d.mts file extension.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 2.0.1

unional pushed a commit to unional/formatjs that referenced this pull request Jun 7, 2023
Fixes formatjs#3999

BREAKING CHANGE: `memoize` is now a named exports rather than a default exporst to workaround shenaginans of bundler compatibility.
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.

Can’t use @formatjs/fast-memoize in isomorphic code

2 participants