Skip to content

fix: Use ESM build only for browser bundlers (not Node.js) - #386

Merged
amannn merged 1 commit into
mainfrom
fix/esm-build-browser-only
Jul 7, 2023
Merged

fix: Use ESM build only for browser bundlers (not Node.js)#386
amannn merged 1 commit into
mainfrom
fix/esm-build-browser-only

Conversation

@amannn

@amannn amannn commented Jul 7, 2023

Copy link
Copy Markdown
Owner

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

vercel Bot commented Jul 7, 2023

Copy link
Copy Markdown

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.
juanforlizzi pushed a commit to juanforlizzi/next-intl that referenced this pull request Jan 16, 2025
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