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

feat!: Make package ESM-only, target modern browsers, use modern JSX transform #1470

Merged
merged 37 commits into from
Oct 29, 2024

Conversation

amannn
Copy link
Owner

@amannn amannn commented Oct 25, 2024

With these optimizations, next-intl is now ~7% smaller and provides full support for tree shaking.

Features

  1. next-intl as well as its base library use-intl are now ESM-only. The only exception is next-intl/plugin which is provided both as ESM as well as CommonJS due to next.config.js still being popular.
  2. The modern JSX transform that was introduced in React 17 is now used.
  3. To reduce bundle size, syntax is compiled down to the Browserslist defaults query, which is a shortcut for > 0.5%, last 2 versions, Firefox ESR, not dead. The defaults query was thoroughly designed by the Browserslist community and is considered a reasonable default for modern apps.

Breaking changes

  1. The CommonJS build has been removed. While most tools support ESM out-of-the-box, some might require additional configuration (e.g. Jest might benefit from next/jest).
  2. The minimum required React version is 17 now.
  3. If you target outdated browsers, you can use transpilePackages in combination with a browserslist config in Next.js to compile next-intl for older browsers.

Copy link

vercel bot commented Oct 25, 2024

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

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 9:05am
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 9:05am
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 9:05am

@amannn amannn changed the title feat!: Modern bundling feat!: Modernize bundling Oct 28, 2024
@amannn amannn changed the title feat!: Modernize bundling feat!: Modern build target (go ESM-only, target modern browsers, use modern JSX transform) Oct 29, 2024
@amannn amannn changed the title feat!: Modern build target (go ESM-only, target modern browsers, use modern JSX transform) feat!: Make package ESM-only, target modern browsers, use modern JSX transform Oct 29, 2024
@amannn amannn marked this pull request as ready for review October 29, 2024 09:10
@amannn amannn mentioned this pull request Oct 29, 2024
9 tasks
@amannn amannn merged commit 9f4754c into v4 Oct 29, 2024
10 checks passed
@amannn amannn deleted the feat/modern-bundling branch October 29, 2024 09:22
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