-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
After #54494, @wordpress/react-i18n is now lacking dependencies or peer dependencies on react. (other affected packages have since been fixed)
This happens to work with npm's hoisting due to other dependencies pulling that package in, but will fail with yarn's p'n'p or pnpm with hoisting disabled.
Reproduction
With yarn:
- Create a temporary directory, and cd into it.
echo '{}' > package.jsonyarn set version stableyarn add @wordpress/react-i18n jsdom global-jsdomyarn node -e 'require( "global-jsdom/register" ); const x = require( "@wordpress/react-i18n" ); console.log( typeof x );'
With pnpm:
- Create a temporary directory, and cd into it.
echo 'hoist-pattern=[]' > .npmrcpnpm add @wordpress/react-i18n global-jsdom(note pnpm 8 defaults to installing peer deps)node -e 'require( "global-jsdom/register" ); const x = require( "@wordpress/react-i18n" ); console.log( typeof x );'
Expected behavior
Output along the lines of
object
Actual behavior
With yarn:
Error: @wordpress/react-i18n tried to access react, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: react (via "react/jsx-runtime")
Required by: @wordpress/react-i18n@npm:4.36.0 (via /home/user/.yarn/berry/cache/@wordpress-react-i18n-npm-4.36.0-164c2bcf50-10c0.zip/node_modules/@wordpress/react-i18n/build/)
Require stack:
- /home/user/.yarn/berry/cache/@wordpress-react-i18n-npm-4.36.0-164c2bcf50-10c0.zip/node_modules/@wordpress/react-i18n/build/index.js
- /tmp/test/[eval]
at require$$0.Module._resolveFilename (/tmp/test/.pnp.cjs:6997:13)
at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
at Function.<anonymous> (node:internal/modules/cjs/loader:1192:37)
at require$$0.Module._load (/tmp/test/.pnp.cjs:6883:31)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Module.require (node:internal/modules/cjs/loader:1463:12)
at require (node:internal/modules/helpers:147:16)
at Object.<anonymous> (/home/user/.yarn/berry/cache/@wordpress-react-i18n-npm-4.36.0-164c2bcf50-10c0.zip/node_modules/@wordpress/react-i18n/build/index.js:30:26)
With pnpm:
Error: Cannot find module 'react/jsx-runtime'
Require stack:
- /tmp/test/node_modules/.pnpm/@[email protected]/node_modules/@wordpress/react-i18n/build/index.js
- /tmp/test/[eval]
at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
at Function._load (node:internal/modules/cjs/loader:1192:37)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Module.require (node:internal/modules/cjs/loader:1463:12)
at require (node:internal/modules/helpers:147:16)
at Object.<anonymous> (/tmp/test/node_modules/.pnpm/@[email protected]/node_modules/@wordpress/react-i18n/build/index.js:30:26)
at Module._compile (node:internal/modules/cjs/loader:1706:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/tmp/test/node_modules/.pnpm/@[email protected]/node_modules/@wordpress/react-i18n/build/index.js',
'/tmp/test/[eval]'
]
}
Metadata
Metadata
Assignees
Labels
[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended