Skip to content

Commit

Permalink
chore: ESM only (drop CJS support)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop CJS support.

Since Next has ESM support since v12, it should not really be a breaking change for most.
  • Loading branch information
franky47 committed May 13, 2024
1 parent 2727585 commit 76cf39e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions packages/nuqs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
],
"type": "module",
"sideEffects": true,
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"import": "./dist/index.js"
},
"./server": {
"types": "./dist/server.d.ts",
Expand All @@ -49,8 +47,7 @@
},
"./parsers": {
"types": "./dist/parsers.d.ts",
"import": "./dist/parsers.js",
"require": "./dist/parsers.cjs"
"import": "./dist/parsers.js"
}
},
"scripts": {
Expand Down Expand Up @@ -89,15 +86,15 @@
},
"size-limit": [
{
"name": "Client (ESM)",
"name": "Client",
"path": "dist/index.js",
"limit": "5 kB",
"ignore": [
"react"
]
},
{
"name": "Server (ESM)",
"name": "Server",
"path": "dist/server.js",
"limit": "2 kB",
"ignore": [
Expand Down
4 changes: 2 additions & 2 deletions packages/nuqs/scripts/prepack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ VERSION=$(cat package.json | jq -r '.version')

if [[ "$(uname)" == "Darwin" ]]; then
# macOS requires an empty string as the backup extension
sed -i '' "s/0.0.0-inject-version-here/${VERSION}/g" dist/index.{js,cjs}
sed -i '' "s/0.0.0-inject-version-here/${VERSION}/g" dist/index.js
else
# Ubuntu (CI/CD) doesn't
sed -i "s/0.0.0-inject-version-here/${VERSION}/g" dist/index.{js,cjs}
sed -i "s/0.0.0-inject-version-here/${VERSION}/g" dist/index.js
fi
2 changes: 1 addition & 1 deletion packages/nuqs/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
parsers: 'src/index.parsers.ts',
server: 'src/index.server.ts'
},
format: ['esm', 'cjs'],
format: ['esm'],
dts: true,
outDir: 'dist',
splitting: true,
Expand Down

0 comments on commit 76cf39e

Please sign in to comment.