JSON5 Manifests and pnpm

pnpm reads package.json5 as a project manifest. Almost nothing else in the JavaScript toolchain does.

pnpm 12 still supports package.json5 and package.yaml, keeps your comments when it edits the file, and publishes a normal package.json to the registry. We ran it to confirm each of those.

We also ran npm and both Yarn generations on the same file. The results explain why this feature stays a niche, and what to check before you adopt it.

A package.json5 manifest read by a pnpm machine while npm and Yarn machines reject the same file

TL;DR: pnpm's docs say it "also supports package.json5 (in JSON5 format) and package.yaml". It still works in pnpm 12.23.0, comments survive edits, and pnpm pack emits a plain package.json. npm and Yarn do not read the file, and Renovate's default patterns do not list it. Use it only when every tool in your pipeline is pnpm. See also Renovate and JSON5.

pnpm logo

What pnpm Supports

The package.json page of pnpm's documentation states it in one sentence: "pnpm also supports package.json5 (in JSON5 format) and package.yaml (in YAML format)." We checked that this still holds in the newest release. npm lists pnpm 12.23.0 as the latest version on 11-29-2026, and we installed packages with it into a project that has only a package.json5.

The implementation is public. The @pnpm/read-project-manifest package (1001.2.6 when we read it) looks for a manifest in a fixed order and stops at the first file it finds:

Order File Parsed with
1package.jsonA strict JSON parser
2package.json5The json5 npm package, version range ^2.2.3
3package.yamlA YAML reader

So pnpm parses JSON5 manifests with the reference JavaScript implementation (see the JavaScript guide). A parse failure is reported with the code ERR_PNPM_JSON5_PARSE and the file path. If none of the three files exists, the error reads "No package.json (or package.yaml, or package.json5) was found". Because package.json is tried first, a leftover package.json next to your package.json5 silently wins.

Support is not a leftover. The 12.15.0 changelog lists fixes that name both formats: reporting linked package versions in linked projects that use them, and having self-update rewrite the pin in "package.yaml or package.json5". The 12.7.0 entry (published 09-25-2026) reads "pnpm now reads and updates package.json5 project manifests. Manifest updates retain comments", and 12.8.0 adds that pnpm add, pnpm version and pnpm pkg set keep JSON5 style when they update the file. We cannot tell from those entries whether pnpm 11 or earlier already read the file, so we give no earlier version.

Edit icon

Editing: Comments Survive

This is the one real advantage of a manifest in JSON5: you can explain a dependency choice next to the dependency. The risk is a tool rewriting the file and wiping the notes, so we tested it. Starting from this file:

// Package manifest, hand-edited { name: 'demo-pkg', version: '1.0.0', // runtime deps dependencies: {}, files: ['index.js'], }

we ran pnpm add is-odd with pnpm 12.23.0. The file afterwards:

// Package manifest, hand-edited { name: 'demo-pkg', version: '1.0.0', // runtime deps dependencies: { 'is-odd': '^3.0.1' }, files: ['index.js'], }

Both comments, the single quotes and the unquoted keys came through, and pnpm wrote its lockfile, pnpm-lock.yaml, beside the manifest. The source explains why: pnpm extracts the comments before it rewrites the file, serializes the data with json5.stringify(), then inserts the comments back. It also detects the original indentation and final newline.

Treat that as a good effort, not a guarantee. Comments are re-inserted by a text routine rather than attached to values, so a tool that moves or deletes a key may leave its comment somewhere unexpected. Review the diff after a bulk change, and see the comments best practices tutorial for comments that stay accurate.

Not the pnpm key: pnpm's docs say it "does not read settings from the pnpm field of package.json" and that settings belong in pnpm-workspace.yaml. That holds regardless of manifest format.

Rocket icon

Publishing: The Registry Gets JSON

npm packages carry a package.json inside the tarball, and every consumer reads that file. We ran pnpm pack in the project above and listed the tarball:

package: [email protected] Tarball Contents index.js package.json

No package.json5 was shipped. The package.json inside was ordinary indented JSON, with quoted keys and the files list as an array. A pnpm publish --dry-run on the same project also worked and targeted the npm registry. So JSON5 is a source format for you; people who install your package never see it, and they need no JSON5 support at all.

That makes the checklist short. Run pnpm pack before the first release and open the generated package.json. Confirm that main, exports, files and bin are what you expect. Keep package.json5 out of the files allow-list; it is not needed in the tarball, and pnpm did not include it in ours.

One caveat applies to the pipeline around publishing. The GitHub Action pnpm/action-setup reads the packageManager field to pick a pnpm version. A pull request teaching it to read package.json5 (#191) was closed without merging on 11-03-2026, so do not assume the action reads a JSON5 manifest. Set the version explicitly in the workflow, or keep a package.json for CI.

Layers icon

Workspaces and pnpm-workspace.yaml

A pnpm monorepo is declared in pnpm-workspace.yaml. That file is YAML only; the docs we read name no JSON5 variant. The packages it lists may use any of the three manifest names, and they can be mixed. We built a workspace with a root and one package using package.json5, plus a second package using package.json that depends on the first through workspace:*:

# pnpm-workspace.yaml packages: - 'packages/*'

pnpm -r list --depth -1 found all three projects, and pnpm install finished with "Scope: all 3 workspace projects". Mixed workspaces therefore work. The cost is mental: people have to remember which package uses which format, and a script that reads manifests with JSON.parse will fail on the JSON5 ones. If you write such scripts, parse with the json5 package instead, as pnpm does.

Forbidden icon

What Does Not Read It

We put the same package.json5 (one dependency, is-odd 3.0.1) in an empty folder and ran each tool on 11-29-2026.

Tool Reads it What happened
pnpm 12.23.0 Yes Installed is-odd and wrote pnpm-lock.yaml
npm 11.6.4 No npm install failed with "Could not read package.json" (ENOENT)
Yarn 1.22.22 No Reported "success" but installed nothing: empty node_modules and an empty yarn.lock
Yarn 4.9.2 No "No project found"
Renovate npm manager Not by default Default file patterns are package.json, pnpm-workspace.yaml and .yarnrc.yml; package.json5 is not mentioned

Yarn 1 fails silently. Its "success" message with an empty install is the dangerous case, because a CI job can go green with no dependencies installed. If a teammate might run Yarn 1 in this repo, they will not get an error.

We did not test Bun, Deno, Dependabot, bundlers or editor integrations, and make no claim about them. The general lesson is the one the config guides repeat: JSON5 support is per tool, so list every program that opens the file and test each. Renovate users should read the Renovate guide, since a dependency bot that does not see your manifest will never open an update.

Target icon

Should You Use package.json5?

Reasonable when

  • Every developer and CI job uses pnpm.
  • Nothing else parses the manifest: no bot, no script, no scanner.
  • You want comments beside dependencies and accept the review overhead.

Avoid when

  • Contributors use npm or Yarn on the repository.
  • You rely on dependency bots that match package.json.
  • You maintain a library and want a repository other people can clone and run without a specific package manager.

For most projects, keep package.json and put the commentary somewhere else: a README section, or the description fields of a config file that does read JSON5. The settings that pnpm itself reads live in pnpm-workspace.yaml, which has real YAML comments. If you want JSON5 in a tool that fully supports it, the Babel, ESLint and Prettier guides are better places to start.

Staying on package.json

If the project cannot switch manifests, comments in package.json covers what works in a plain package.json under npm, pnpm, Yarn and Bun, with the real error each one prints.

pnpm and JSON5: Common Questions

Does pnpm support package.json5?

Yes. The docs say so, and pnpm 12.23.0 installed packages into a project that had only that file.

Does npm read it?

No. In npm 11.6.4, npm install failed with "Could not read package.json".

Can I publish from it?

Yes. pnpm pack produced a tarball containing a plain package.json, and pnpm publish --dry-run succeeded.

Are my comments kept when pnpm edits the file?

In our pnpm add test, yes. Comments are extracted and re-inserted, so review the diff after large changes.

Which file wins if I have several?

pnpm tries package.json, then package.json5, then package.yaml, and uses the first it finds.

Does pnpm-workspace.yaml have a JSON5 form?

Not that the pnpm docs describe. Workspace settings live in that YAML file.