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: Use ESM build only for browser bundlers (not Node.js) #386

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

amannn
Copy link
Owner

@amannn amannn commented Jul 7, 2023

Note: We can't go full ESM yet, because this requires that upstream dependencies are ESM too (Next.js isn't). These imports would otherwise fail (e.g. because they don't use explicit file extensions).

If we attempt adding ESM support again in the future, consider:

  1. We have verbose error messages in dev mode, therefore make sure they can be stripped from a production build.
  2. Node doesn't read module, only exports
  3. TS has different module resolution algorithms that need to be tested (moduleResolution: "node16")
  4. Make sure bundle size doesn't grow (neither of the library, nor when compiled in examples)

@vercel
Copy link

vercel bot commented Jul 7, 2023

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

Name Status Preview Comments Updated (UTC)
example-next-13-next-auth ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 8:17am
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 8:17am
next-intl-example-next-13 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2023 8:17am

@amannn amannn mentioned this pull request Jul 7, 2023
@amannn amannn marked this pull request as ready for review July 7, 2023 08:16
@amannn amannn merged commit 34a69f2 into main Jul 7, 2023
@amannn amannn deleted the fix/esm-build-browser-only branch July 7, 2023 09:44
amannn added a commit that referenced this pull request Jul 7, 2023
Extracted to #386, should be
merged to RSC later as well.
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.

1 participant