From bf42830a81935d5d81a02b8ae67988fa8ffaab96 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 28 Jul 2026 12:32:42 -0400 Subject: [PATCH 1/2] Drop the CommonJS build of neaps --- .changeset/neaps-esm-only.md | 8 ++++++++ packages/neaps/package.json | 5 ++--- packages/neaps/tsdown.config.ts | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .changeset/neaps-esm-only.md create mode 100644 packages/neaps/tsdown.config.ts diff --git a/.changeset/neaps-esm-only.md b/.changeset/neaps-esm-only.md new file mode 100644 index 0000000..5a80a65 --- /dev/null +++ b/.changeset/neaps-esm-only.md @@ -0,0 +1,8 @@ +--- +"neaps": minor +--- + +Drop the CommonJS build; neaps is now ESM-only. The CJS entry can't survive +its dependencies going ESM-only, since it loads them with `require()`. CommonJS +consumers on Node 20.19+ / 22.12+ can still `require("neaps")` via Node's +`require(esm)` support. diff --git a/packages/neaps/package.json b/packages/neaps/package.json index 7bd30e3..508c0c6 100644 --- a/packages/neaps/package.json +++ b/packages/neaps/package.json @@ -18,12 +18,11 @@ "license": "MIT", "author": "Brandon Keepers ", "type": "module", - "main": "dist/index.cjs", + "main": "dist/index.js", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": "./dist/index.js" } }, "files": [ diff --git a/packages/neaps/tsdown.config.ts b/packages/neaps/tsdown.config.ts new file mode 100644 index 0000000..e6e194c --- /dev/null +++ b/packages/neaps/tsdown.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from "tsdown"; + +// ESM-only: the CJS build externalized require("@neaps/tide-database"), which +// breaks once tide-database ships only ESM. require() still works on +// Node >= 20.19 / 22.12 via require(esm). +export default defineConfig({ + entry: ["./src/index.ts"], + dts: true, + format: ["esm"], + sourcemap: true, + declarationMap: true, + target: "es2020", + platform: "neutral", +}); From 4d552048c1e58589de5aed5ab7824b9d1cc64427 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 28 Jul 2026 12:38:26 -0400 Subject: [PATCH 2/2] Make all packages ESM-only The repo-wide tsdown config and @neaps/react's own config emitted dual CJS/ESM builds. The CJS entries of neaps, @neaps/tide-predictor, and @neaps/react loaded sibling packages with external require() calls, which breaks once @neaps/tide-database ships only ESM. Node 20.19+ / 22.12+ can still require() these packages via require(esm). --- .changeset/neaps-esm-only.md | 10 ++++++---- packages/neaps/tsdown.config.ts | 14 -------------- packages/react/package.json | 5 ++--- packages/react/tsdown.config.ts | 2 +- packages/tide-predictor/package.json | 5 ++--- tsdown.config.js | 2 +- 6 files changed, 12 insertions(+), 26 deletions(-) delete mode 100644 packages/neaps/tsdown.config.ts diff --git a/.changeset/neaps-esm-only.md b/.changeset/neaps-esm-only.md index 5a80a65..419c569 100644 --- a/.changeset/neaps-esm-only.md +++ b/.changeset/neaps-esm-only.md @@ -1,8 +1,10 @@ --- "neaps": minor +"@neaps/tide-predictor": minor +"@neaps/react": minor --- -Drop the CommonJS build; neaps is now ESM-only. The CJS entry can't survive -its dependencies going ESM-only, since it loads them with `require()`. CommonJS -consumers on Node 20.19+ / 22.12+ can still `require("neaps")` via Node's -`require(esm)` support. +Drop the CommonJS builds; all neaps packages are now ESM-only. The CJS entries +can't survive their dependencies going ESM-only, since they load them with +`require()`. CommonJS consumers on Node 20.19+ / 22.12+ can still `require()` +these packages via Node's `require(esm)` support. diff --git a/packages/neaps/tsdown.config.ts b/packages/neaps/tsdown.config.ts deleted file mode 100644 index e6e194c..0000000 --- a/packages/neaps/tsdown.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from "tsdown"; - -// ESM-only: the CJS build externalized require("@neaps/tide-database"), which -// breaks once tide-database ships only ESM. require() still works on -// Node >= 20.19 / 22.12 via require(esm). -export default defineConfig({ - entry: ["./src/index.ts"], - dts: true, - format: ["esm"], - sourcemap: true, - declarationMap: true, - target: "es2020", - platform: "neutral", -}); diff --git a/packages/react/package.json b/packages/react/package.json index 0a5bc88..f9262ff 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -19,12 +19,11 @@ "license": "MIT", "author": "Brandon Keepers ", "type": "module", - "main": "dist/index.cjs", + "main": "dist/index.js", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": "./dist/index.js" }, "./styles.css": "./dist/styles.css" }, diff --git a/packages/react/tsdown.config.ts b/packages/react/tsdown.config.ts index deb3ab8..4b3ef73 100644 --- a/packages/react/tsdown.config.ts +++ b/packages/react/tsdown.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "tsdown"; export default defineConfig({ entry: ["./src/index.ts"], dts: true, - format: ["cjs", "esm"], + format: ["esm"], sourcemap: true, target: "es2020", platform: "browser", diff --git a/packages/tide-predictor/package.json b/packages/tide-predictor/package.json index 75be49d..a2fbcc7 100644 --- a/packages/tide-predictor/package.json +++ b/packages/tide-predictor/package.json @@ -10,12 +10,11 @@ "author": "Kevin Miller ", "license": "MIT", "type": "module", - "main": "dist/index.cjs", + "main": "dist/index.js", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": "./dist/index.js" } }, "files": [ diff --git a/tsdown.config.js b/tsdown.config.js index 5f71df8..2ad13f7 100644 --- a/tsdown.config.js +++ b/tsdown.config.js @@ -3,7 +3,7 @@ import { defineConfig } from "tsdown"; export default defineConfig({ entry: ["./src/index.ts"], dts: true, - format: ["cjs", "esm"], + format: ["esm"], sourcemap: true, declarationMap: true, target: "es2020",