-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
I want to be able to have a CI step that checks there are no warnings in my yarn environment; however using esm and pnp creates a warning I cannot suppress or filter out. This makes it particularly complex to detect issues.
Specifically: when a project uses ESM (type: "module" or has ESM dependencies), yarn install emits:
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: · Done with warnings in 0s 508ms
There appears to be no way to detect or filter this:
logFilterscannot filter it: The warning uses message codeYN0000(MessageName.UNNAMED). The log filter implementation explicitly bypasses code 0:if(C===null||C===0) return xskips all text/pattern/code matching and returns the default level. This is tracked in [Bug?]: yarn 4 logFilters is unable to filter most messages #6221.
2. No structured output: yarn install does not support --json, so there's no machine-readable way to parse warnings from output.
-
No non-zero exit code:
exitCode()only checksthis.errorCount > 0.warningCountonly changes the "Done with warnings" text but the process exits 0. -
The warning itself is unavoidable: As described in [Bug?]: Implicit behaviour of
pnpEnableEsmLoader: falseis not documented or communicated #5747,pnpEnableEsmLoaderis implicitly enabled when any dependency usestype: "module", regardless of the config defaulting tofalse. Setting it explicitly tofalsewould disable ESM support, which isn't viable.
The result is that CI pipelines cannot treat warnings as failures (to catch real issues), without catching known-harmless warnings
To reproduce
package.json:
{
"name": "example",
"packageManager": "yarn@4.13.0",
"type": "module",
"dependencies": {
"cowsay": "^1.6.0"
}
}.yarnrc.yml:
nodeLinker: pnp
logFilters:
- code: YN0000
text: "ESM support for PnP uses the experimental loader API and is therefore experimental"
level: discardThen run yarn install
Environment
System:
OS: Linux 6.8 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Binaries:
Node: 25.6.1 - /tmp/xfs-96160961/node
Yarn: 4.13.0 - /tmp/xfs-96160961/yarn
npm: 11.9.0 - /home/redacted/.nvm/versions/node/v25.6.1/bin/npm
bun: 1.3.9 - /home/redacted/.bun/bin/bun
Deno: 2.5.6 - /home/redacted/.deno/bin/denoAdditional context
I'd happily produce a fix for this; but its quite unclear what would be accepted.
Filtering YN0000 seems against an existing policy; adding --json to install with a {warnings:[]} that can be filtered with jq seems like a very large change; removing the warning seems possible, but may be contentious