Skip to content

Build/test tools: fix Zod export error in JavaScript linting - #12704

Closed
lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/lint-tooling-gaps
Closed

Build/test tools: fix Zod export error in JavaScript linting#12704
lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/lint-tooling-gaps

Conversation

@lancewillett

Copy link
Copy Markdown
Contributor

Fixes the ERR_PACKAGE_PATH_NOT_EXPORTED error for zod/v4/core after a clean npm ci.

The dependency tree installed Zod 3.23.8. This change overrides Zod to 3.25.1 and updates the
lockfile.

Zod 3.25.0 declares the export but lacks its CommonJS target. Version 3.25.1 is the smallest working release.

Trac ticket: https://core.trac.wordpress.org/ticket/65723

Verification

  • Reproduced the failure after a
    clean npm ci.
  • Ran npm run lint:jsdoc.
  • Ran npm run grunt -- jshint.
  • Ran npm run typecheck:js.
  • Confirmed all Zod consumers resolve to 3.25.1.
  • Loaded the Chromium BiDi parser
    successfully.

Copilot AI review requested due to automatic review settings July 27, 2026 00:13
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props lancewillett, mukesh27.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@lancewillett lancewillett changed the title Build tools: Fix Zod export error in JavaScript linting Build/test tools: fix Zod export error in JavaScript linting Jul 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a JavaScript linting failure (ERR_PACKAGE_PATH_NOT_EXPORTED for zod/v4/core) after a clean npm ci by forcing the dependency graph to use a Zod version that correctly exports the needed path.

Changes:

  • Add an npm overrides entry to pin zod to 3.25.1.
  • Update package-lock.json to reflect the new resolved Zod version and remove the previously nested Zod copy.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
package.json Adds an npm override to force Zod to 3.25.1 to avoid the export-path error.
package-lock.json Updates lockfile resolutions to Zod 3.25.1 and removes the nested Zod instance under eslint-plugin-react-hooks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment on lines +115 to +117
"overrides": {
"zod": "3.25.1"
},
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Pin the smallest Zod release that provides the export required by the JSDoc lint toolchain.

Fixes #65723.

Props lance.willett@automattic.com
@lancewillett
lancewillett force-pushed the fix/lint-tooling-gaps branch from a0bb794 to e79dbf8 Compare July 27, 2026 02:05
@mukeshpanchal27

Copy link
Copy Markdown
Member

I replicate the issue when running npm run lint:jsdoc

> WordPress@7.1.0 lint:jsdoc
> wp-scripts lint-js

(node:83093) ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignore-files
(Use `node --trace-warnings ...` to show where the warning was created)

Oops! Something went wrong! :(

ESLint: 10.7.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4/core' is not defined by "exports" in /Users/mukesh/wordpress-develop/node_modules/zod/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:322:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:670:9)
    at resolveExports (node:internal/modules/cjs/loader:638:36)
    at Module._findPath (node:internal/modules/cjs/loader:711:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1193:27)
    at Module._load (node:internal/modules/cjs/loader:1038:27)
    at Module.require (node:internal/modules/cjs/loader:1289:19)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/Users/mukesh/wordpress-develop/node_modules/zod-validation-error/v4/index.js:698:19)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)

@mukeshpanchal27 mukeshpanchal27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-approved.

npm run lint:jsdoc takes quite a long time in my local environment, but I'm no longer seeing the Error [ERR_PACKAGE_PATH_NOT_EXPORTED] error.

pento pushed a commit that referenced this pull request Jul 27, 2026
A clean `npm ci` resolves Zod to 3.23.8, so `zod/v4/core` fails with ERR_PACKAGE_PATH_NOT_EXPORTED and breaks the JSDoc lint run. Pin Zod to 3.25.1 with a package.json override and update the lockfile. 3.25.1 is the smallest release that ships the required export with a CommonJS target; 3.25.0 declares the export but omits the CommonJS build. All Zod consumers now resolve to 3.25.1. (Now that's a lotta Zod!)

Developed in: #12704

Props mukesh27, adrianmoldovanwp
Fixes #65723


git-svn-id: https://develop.svn.wordpress.org/trunk@62861 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 27, 2026
A clean `npm ci` resolves Zod to 3.23.8, so `zod/v4/core` fails with ERR_PACKAGE_PATH_NOT_EXPORTED and breaks the JSDoc lint run. Pin Zod to 3.25.1 with a package.json override and update the lockfile. 3.25.1 is the smallest release that ships the required export with a CommonJS target; 3.25.0 declares the export but omits the CommonJS build. All Zod consumers now resolve to 3.25.1. (Now that's a lotta Zod!)

Developed in: WordPress/wordpress-develop#12704

Props mukesh27, adrianmoldovanwp
Fixes #65723

Built from https://develop.svn.wordpress.org/trunk@62861


git-svn-id: http://core.svn.wordpress.org/trunk@62141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62861
GitHub commit: a331245

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants