Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/declare-node-engines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@granite-js/plugin-core': patch
---

Declare the minimum required Node.js version (`>=22.15.0`) in the `engines` field.

`@granite-js/plugin-core` is a CJS bundle that does `require('c12')`, and c12 v3 is an ESM-only package. Under Yarn PnP, the `require(esm)` module graph is resolved with Node's default ESM resolver on Node.js < 22.15.0, ignoring the PnP loader hooks — so c12's own imports (e.g. `pathe`) fail with `ERR_MODULE_NOT_FOUND` at runtime. Node.js 22.15.0 routes `require(esm)` resolution through registered customization hooks (nodejs/node#55698), which makes it work with Yarn PnP.

Declaring `engines` documents this requirement in a machine-readable way: npm prints an `EBADENGINE` warning at install time, pnpm fails the install with `engine-strict=true`, and deployment platforms and tooling pick up the field. Note that Yarn Berry does not enforce `engines`, so PnP users still need a matching Node.js version at runtime.
3 changes: 3 additions & 0 deletions packages/plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"files": [
"dist"
],
"engines": {
"node": ">=22.15.0"
},
"devDependencies": {
"@types/node": "catalog:tools",
"@vitest/coverage-v8": "^4.0.12",
Expand Down
Loading