Skip to content

Commit

Permalink
fix: Use ESM build only for browser bundlers (not Node.js)
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Jul 7, 2023
1 parent 287e8e5 commit 22eafe2
Show file tree
Hide file tree
Showing 9 changed files with 2,714 additions and 1,029 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jobs:
- run: pnpm run build
- run: pnpm run lint
- run: pnpm run test
- run: pnpm run size
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"test": "turbo run test --concurrency 1",
"lint": "turbo run lint",
"prepare": "turbo run build --filter './packages/**'",
"size": "turbo run size",
"publish": "lerna publish --yes --no-private"
},
"devDependencies": {
Expand Down
47 changes: 24 additions & 23 deletions packages/next-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,36 @@
"url": "https://github.com/amannn/next-intl"
},
"scripts": {
"build": "tsup",
"build": "pnpm build:default && pnpm build:rsc",
"build:default": "rm -rf dist && dts build",
"build:rsc": "tsc && rm -rf dist/test",
"test": "TZ=Europe/Berlin vitest",
"lint": "eslint src test && tsc --noEmit",
"prepublishOnly": "CI=true turbo test && turbo lint && turbo build && cp ../../README.md .",
"postpublish": "git checkout . && rm ./README.md"
"postpublish": "git checkout . && rm ./README.md",
"size": "size-limit"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"module": "dist/next-intl.esm.js",
"typings": "dist/index.d.ts",
"exports": {
".": {
"react-server": {
"node": "./dist/react-server/index.js",
"import": "./dist/react-server/index.mjs",
"default": "./dist/react-server/index.js"
},
"node": "./dist/index.js",
"import": "./dist/index.mjs",
"react-server": "./dist/src/react-server/index.js",
"default": "./dist/index.js"
},
"./server": {
"node": "./dist/server/index.js",
"import": "./dist/server/index.mjs",
"default": "./dist/server/index.js"
"default": "./dist/src/server/index.js"
},
"./client": {
"node": "./dist/client/index.js",
"import": "./dist/client/index.mjs",
"default": "./dist/client/index.js"
"default": "./dist/src/client/index.js"
},
"./link": {
"types": "./link.d.ts",
"node": "./dist/link/index.js",
"import": "./dist/link/index.mjs",
"default": "./dist/link/index.js"
"default": "./dist/src/link/index.js"
},
"./middleware": {
"types": "./middleware.d.ts",
"node": "./dist/middleware/index.js",
"import": "./dist/middleware/index.mjs",
"default": "./dist/middleware/index.js"
"default": "./dist/src/middleware/index.js"
}
},
"files": [
Expand Down Expand Up @@ -85,20 +74,32 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@size-limit/preset-big-lib": "^8.2.6",
"@testing-library/react": "^13.0.0",
"@types/negotiator": "^0.6.1",
"@types/node": "^17.0.23",
"@types/react": "^18.2.5",
"dts-cli": "^1.4.0",
"eslint": "^8.39.0",
"eslint-config-molindo": "^6.0.0",
"eslint-plugin-deprecation": "^1.4.1",
"next": "^13.4.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^7.1.0",
"size-limit": "^8.2.6",
"typescript": "^4.9.5",
"vitest": "^0.32.2"
},
"size-limit": [
{
"path": "dist/next-intl.cjs.production.min.js",
"limit": "13.8 KB"
},
{
"path": "dist/next-intl.cjs.development.js",
"limit": "13.8 KB"
}
],
"engines": {
"node": ">=10"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/next-intl/src/react-server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function notSupported() {
`The React APIs of next-intl are currently not available in Server Components.
You can try one of these options:
1. Try out the Server Components beta, see https://next-intl-docs.vercel.app/docs/next-13/server-components
2. Use the core library as a stopgap solution, see https://next-intl-docs.vercel.app/docs/usage/core-library
1. Try out the Server Components beta, see https://next-intl-docs.vercel.app/docs/getting-started
2. Use the core library as a stopgap solution, see https://next-intl-docs.vercel.app/docs/environments/core-library
`
);
}
Expand Down
13 changes: 0 additions & 13 deletions packages/next-intl/tsup.config.js

This file was deleted.

23 changes: 19 additions & 4 deletions packages/use-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
"url": "https://github.com/amannn/next-intl/tree/main/packages/use-intl"
},
"scripts": {
"build": "tsup",
"build": "pnpm build:default && pnpm build:rsc",
"build:default": "rm -rf dist && dts build",
"build:rsc": "tsc && rm -rf dist/test",
"test": "TZ=Europe/Berlin vitest",
"lint": "eslint src test && tsc --noEmit",
"prepublishOnly": "CI=true turbo test && turbo lint && turbo build"
"prepublishOnly": "CI=true turbo test && turbo lint && turbo build",
"size": "size-limit"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"module": "dist/use-intl.esm.js",
"typings": "dist/index.d.ts",
"files": [
"dist",
Expand All @@ -42,18 +45,30 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@size-limit/preset-big-lib": "^8.2.6",
"@testing-library/react": "^13.0.0",
"@types/node": "^17.0.23",
"@types/react": "^18.2.5",
"date-fns": "^2.16.1",
"dts-cli": "^1.4.0",
"eslint": "^8.39.0",
"eslint-config-molindo": "^6.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^7.1.0",
"size-limit": "^8.2.6",
"typescript": "^4.9.5",
"vitest": "^0.32.2"
},
"size-limit": [
{
"path": "dist/use-intl.cjs.production.min.js",
"limit": "10.3 kB"
},
{
"path": "dist/use-intl.cjs.development.js",
"limit": "10.3 kB"
}
],
"engines": {
"node": ">=10"
}
Expand Down
24 changes: 0 additions & 24 deletions packages/use-intl/tsup.config.js

This file was deleted.

Loading

0 comments on commit 22eafe2

Please sign in to comment.