Move @emotion deps out of root package.json#78687
Conversation
Move @emotion/is-prop-valid, @emotion/native, @emotion/react, and @emotion/styled out of the root `package.json` and into the workspaces that actually consume them, making dependency relationships explicit instead of relying on root hoisting. - `packages/components`: add `@emotion/native` (consumed by `src/text/index.native.js` and `src/text/styles/emotion-css.native.js`, previously a phantom dependency on the root). - `storybook`: add `@emotion/react`, `@emotion/styled` (consumed by `main.ts`, decorators, and stories), and `@emotion/is-prop-valid` (declared to silence the framer-motion warning per #68202). - Root `package.json`: remove the four entries above.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Moves select @emotion/* packages out of the monorepo root package.json into the specific workspaces that use them, reducing reliance on hoisted/phantom dependencies and fixing a missing direct dependency in @wordpress/components.
Changes:
- Removed
@emotion/is-prop-valid,@emotion/native,@emotion/react, and@emotion/styledfrom the rootpackage.json. - Added
@emotion/nativetopackages/components(fixes missing dependency for React Native entrypoints). - Added
@emotion/is-prop-valid,@emotion/react, and@emotion/styledtostorybookdevDependencies; regeneratedpackage-lock.json.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
storybook/package.json |
Declares Emotion packages used by Storybook (and the is-prop-valid peer workaround) locally in the Storybook workspace. |
packages/components/package.json |
Adds missing @emotion/native dependency required by native component entrypoints. |
package.json |
Removes Emotion runtime deps from root to avoid phantom dependency usage. |
package-lock.json |
Lockfile update reflecting the workspace-scoped dependency moves. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Size Change: 0 B Total Size: 8.18 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 3631133. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26452934956
|
What?
Related to #75041
Move four
@emotion/*packages out of the rootpackage.jsonand into the workspaces that actually use them:@emotion/is-prop-valid@emotion/native@emotion/react@emotion/styledWhy?
The root
package.jsoncurrently lists every@emotion/*dependency, even though most of them are only used bypackages/componentsandstorybook. Other workspaces only access them transitively through root hoisting (phantom dependencies). Declaring dependencies on the workspace that consumes them is the foundational step that #75041 is driving toward.This also surfaced a real bug:
packages/componentswas missing@emotion/nativefrom itsdependencies, even thoughsrc/text/index.native.jsandsrc/text/styles/emotion-css.native.jsimport from it. It was only working because the root hoisted it. The same package is consumed under stricter dependency isolation (e.g. pnpm strict installs, npminstall-strategy=linked), where this would break.How?
packages/components/package.json: add@emotion/nativetodependencies. Fixes the missing-dep bug above.storybook/package.json: add@emotion/react,@emotion/styled, and@emotion/is-prop-validtodevDependencies. The first two are imported bymain.ts, decorators, and stories;@emotion/is-prop-validwas added at the root in Storybook: Fixemotion/is-prop-validwarning #68202 to silence aframer-motionwarning surfaced by Storybook, so it belongs here.package.json: remove the four entries above.package-lock.json: regenerated vianpm install.Out of scope
@emotion/babel-pluginand@emotion/jestare intentionally left at the root. They get moved as part of the broader babel deps and test/jest deps sub-tasks of #75041, each of which needs additional config refactors.Testing Instructions
npm install.npm run clean:package-types && npm run build.npm run storybook:build.npm run test:unit.@emotion/*resolution still works from consumer workspaces, e.g.:Testing Instructions for Keyboard
n/a — dependency move only, no UI changes.
Screenshots or screencast
n/a — dependency move only.
Use of AI Tools
Authored with Claude Code; all changes were reviewed and verified locally (build + Storybook build + 894 unit-test suites passing).