-
-
Notifications
You must be signed in to change notification settings - Fork 236
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: Add full ESM support via an import
export condition
#755
Conversation
# Conflicts: # packages/next-intl/package.json # packages/use-intl/package.json
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -21,7 +21,7 @@ | |||
"test": "TZ=Europe/Berlin vitest", | |||
"lint": "pnpm run lint:source && pnpm run lint:package", | |||
"lint:source": "eslint src test && tsc --noEmit", | |||
"lint:package": "publint && attw --pack", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Revert or use
.mjs
?
packages/use-intl/package.json
Outdated
@@ -15,7 +15,7 @@ | |||
"test": "TZ=Europe/Berlin vitest", | |||
"lint": "pnpm run lint:source && pnpm run lint:package", | |||
"lint:source": "eslint src test && tsc --noEmit", | |||
"lint:package": "publint && attw --pack", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Revert or use
.mjs
?
import
export condition for ESM supportimport
export condition to enable ESM support
import
export condition to enable ESM supportimport
export condition
…xt-intl missing atm)
# Conflicts: # packages/next-intl/package.json # packages/next-intl/plugin.d.ts # packages/next-intl/src/plugin.tsx # packages/use-intl/package.json # pnpm-lock.yaml
/** @type import('rollup').RollupOptions */ | ||
const config = { | ||
input, | ||
external: [/node_modules/, ...external], | ||
output: { | ||
dir: outDir + env, | ||
format: 'cjs', | ||
format, | ||
entryFileNames: '[name]' + (format === 'es' ? '.mjs' : '.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
Superseded by #1115 |
We currently support ESM partially. This PR investigates switching to bunchee in order to enable full ESM support.
TODO
production
environment instead and ship full errors by default for other entry points? That would result in Next.js getting the smallest build, test runners getting unminified errors—and, users ofuse-intl
(e.g.react-native
) potentially also unminified errors. Should we ship a version where a condition liketypeof process !== 'undefined' && process.env.NODE_ENV === 'production'
is included in the bundle? Maybe shipdevelopment
,production
as well asdefault
with with an uncompiled condition liketypeof process !== 'undefined' && process.env.NODE_ENV === 'production' ?
to support everything.