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

ESM module export #821

Open
wants to merge 5 commits into
base: v3
Choose a base branch
from
Open

ESM module export #821

wants to merge 5 commits into from

Conversation

BANOnotIT
Copy link
Collaborator

@BANOnotIT BANOnotIT commented Apr 20, 2024

Repo is copied from #816 inside to test in future
fix(async): bundler esm import
fix(core-v1): bundler esm import
fix(core): bundler esm import
fix(effects): bundler esm import
fix(eslint-plugin): bundler esm import
fix(form-web): bundler esm import
fix(form): bundler esm import
fix(framework): bundler esm import
fix(hooks): bundler esm import
fix(jsx): bundler esm import
fix(lens): bundler esm import
fix(logger): bundler esm import
fix(npm-cookie-baker): bundler esm import
fix(npm-history): bundler esm import
fix(npm-lit): bundler esm import
fix(npm-react): bundler esm import
fix(npm-solid-js): bundler esm import
fix(npm-svelte): bundler esm import
fix(npm-vue): bundler esm import
fix(persist-web-storage): bundler esm import
fix(persist): bundler esm import
fix(primitives): bundler esm import
fix(react-v1): bundler esm import
fix(testing): bundler esm import
fix(timer): bundler esm import
fix(undo): bundler esm import
fix(url): bundler esm import
fix(utils): bundler esm import
fix(web-fetch): bundler esm import
fix(web): bundler esm import

Reatom used to use package.json#module field to declare esm modules.
Turns out it was only in draft spec and never was standardized.
So instead of relying on non-standard behaviour we use .mjs which is
standard nodejs mechanizm.

Should fix #816 #806 #573
@BANOnotIT BANOnotIT self-assigned this Apr 20, 2024
Copy link

stackblitz bot commented Apr 20, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Apr 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reatom ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 3, 2024 7:10pm

@BANOnotIT
Copy link
Collaborator Author

Initial confusion is likely to be caused by how microbundle handles ESM building by assuming everything in package.json#module is ESM. But now it checks for package.json#type also.

@Akiyamka
Copy link
Collaborator

Akiyamka commented Apr 21, 2024

How esbuild read package.json
https://esbuild.github.io/api/#platform

artalar
artalar previously approved these changes Apr 22, 2024
@artalar
Copy link
Owner

artalar commented Apr 22, 2024

@BANOnotIT if this is ready - merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants