diff --git a/.changeset/nervous-pianos-repeat.md b/.changeset/nervous-pianos-repeat.md new file mode 100644 index 0000000..c939c11 --- /dev/null +++ b/.changeset/nervous-pianos-repeat.md @@ -0,0 +1,17 @@ +--- +"@portabletext/react-pdf": major +--- + +The package is now ESM only, and requires Node.js 22.12 or later + +#### When you will see a difference + +Only if you load this package with `require()`, or build on Node.js 20 or earlier. If you already `import` it, nothing changes. + +#### What changes + +The package no longer ships a CommonJS build. `require("@portabletext/react-pdf")` will fail, where before it resolved to `dist/index.cjs`. Use `import` instead, or a dynamic `await import()` from a CommonJS file. + +This brings the package in line with the rest of the Portable Text packages, which are already ESM only. + +Node.js 20 reached end of life in April 2026. The package previously declared no `engines` range at all, so nothing was enforced. diff --git a/package.json b/package.json index ac41ad5..408eada 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,11 @@ ".": { "source": "./src/index.ts", "import": "./dist/index.js", - "require": "./dist/index.cjs", "default": "./dist/index.js" }, "./package.json": "./package.json" }, - "main": "./dist/index.cjs", - "module": "./dist/index.js", + "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist", @@ -97,6 +95,9 @@ "vite": "^7.1.3", "vitest": "^3.2.4" }, + "engines": { + "node": ">=22.12" + }, "packageManager": "pnpm@10.11.1", "publishConfig": { "access": "public"