Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const config: StorybookConfig = {
plugins: [
dsTokenFallbacksJs(),
react( {
jsxImportSource: getAbsolutePath( '@emotion/react' ),
jsxImportSource: '@emotion/react',

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.

With this change, we will need to set an alias for this; otherwise, it will break the isolated build.

diff --git a/storybook/main.ts b/storybook/main.ts
index 36358c13df1..fd266c7de2c 100644
--- a/storybook/main.ts
+++ b/storybook/main.ts
@@ -224,6 +224,16 @@ const config: StorybookConfig = {
 				),
 			},
 			resolve: {
+				alias: {
+					/*
+					 * `jsxImportSource` injects `@emotion/react` into every JSX
+					 * file, including stories in packages that don't depend on
+					 * it (e.g. block-editor) and can't resolve it under the
+					 * isolated dependency layout. Alias it to this workspace's
+					 * copy — the one all consumers already resolve to.
+					 */
+					'@emotion/react': getAbsolutePath( '@emotion/react' ),
+				},
 				/*
 				 * Resolve Storybook packages from this workspace.
 				 */

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.

Better yet: We can remove this altogether? 🙂 #80647

babel: {
plugins: [ getAbsolutePath( '@emotion/babel-plugin' ) ],
},
Expand Down
Loading