The manifest file of a package.

Fields

engines

You can specify the version of Node and pnpm that your stuff works on:

{
    "engines": {
        "node": ">=10",
        "pnpm": ">=3"
    }
}

During local development, pnpm will always fail with an error message when its version will not match the one in engines.pnpm.

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

peerDependenciesMeta

This field lists some extra information related to the dependencies listed in the peerDependencies field.

peerDependenciesMeta[pkg].optional

If true, the selected peer dependency will be marked as optional by the package manager and the consumer omitting it won't be reported as an error.

{
    "peerDependencies": {
        "react-dom": "1"
    },
    "peerDependenciesMeta": {
        "react-dom": {
            "optional": true
        },
        // express is not specified in the peerDependencies field,
        // so pnpm will assume that any version of express is fine
        "express": {
            "optional": true
        }
    }
}

publishConfig

Added in: v3.4.0

It is possible to override some fields in the manifest, before the package is packed. The following fields may be overridden: bin, main, exports, types or typings, module, browser, esnext, es2015, unpkg and umd:main.

To override a field, add the publish version of the field to publishConfig.

For instance, the following package.json:

{
    "name": "foo",
    "version": "1.0.0",
    "main": "src/index.ts",
    "publishConfig": {
        "main": "lib/index.js",
        "typings": "lib/index.d.ts"
    }
}

Will be published as:

{
    "name": "foo",
    "version": "1.0.0",
    "main": "lib/index.js",
    "typings": "lib/index.d.ts"
}

pnpm.overrides

Added in: v5.10.1

This field allows you to instruct pnpm to override any dependency in the dependency graph. This is useful to enforce all your packages to use a single version of a dependency, backport a fix, or replace a dependency with a fork.

Note that the overrides field can only be set at the root of the project.

An example of the "pnpm"."overrides" field:

{
  "pnpm": {
    "overrides": {
      "foo": "^1.0.0",
      "bar@^2.1.0": "3.0.0",
      "qar@1>zoo": "2"
    }
  }
}

You may specify the package to which the overriden dependency belongs by separating the package selector from the dependency selector with a ">", for example qar@1>zoo will only override the zoo dependency of any qar@1 dependency.

pnpm.neverBuiltDependencies

Added in: v5.16.0

This field allows to ignore the builds of specific dependencies.

An example of the "pnpm"."neverBuiltDependencies" field:

{
  "pnpm": {
    "neverBuiltDependencies": ["fsevents", "level"]
  }
}