Skip to content

Reuse PostCSS browser resolver in Storybook smoke tests - #83635

Merged
ciampo merged 1 commit into
trunkfrom
codex/83611-storybook-postcss-browser
Sep 28, 2026
Merged

ciampo merged 1 commit into
trunkfrom
codex/83611-storybook-postcss-browser

Conversation

@ciampo

@ciampo ciampo commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

See #83611 and vitejs/vite#23512.

What?

Reuse the PostCSS browser import resolver in Storybook's dependency optimizer. A cold Storybook smoke run now has zero browser-externalization messages instead of 230.

Why?

PostCSS marks optional Node imports as browser: false, but Vite still exposes warning-producing browser externals for them. The existing Browser Mode resolver already handles only those imports from PostCSS.

How?

Move the resolver into Storybook's private config so Storybook and Browser Mode share it. Add it only to Storybook's dependency optimization. Imports outside PostCSS still use Vite's normal resolution.

Testing Instructions

  1. In a fresh checkout or with a fresh Storybook dependency cache, run npm run --workspace @wordpress/storybook test:smoke. Confirm all 233 files and 875 stories pass without browser-externalization messages.
  2. Run node node_modules/vitest/vitest.mjs run --config test/unit/vitest.config.mjs --project browser test/unit/config/postcss.browser.test.js and confirm the existing PostCSS regression test passes.

Use of AI Tools

Codex drafted the change and PR description. I reviewed the diff and verified the cold Storybook run, build, Browser Mode test, typecheck, and lint.

@ciampo ciampo added the [Type] Build Tooling Issues or PRs related to build tooling label Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: 0 B

Total Size: 8.24 MB

27fb60c Run

@ciampo ciampo self-assigned this Sep 28, 2026
@ciampo
ciampo requested review from a team, Mamaduka and manzoorwanijk September 28, 2026 16:32
@ciampo
ciampo marked this pull request as ready for review September 28, 2026 16:32
@github-actions

github-actions Bot commented Sep 28, 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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

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

@ciampo
ciampo force-pushed the codex/83611-storybook-postcss-browser branch from 0e84d4c to 27fb60c Compare September 28, 2026 21:47
@ciampo
ciampo merged commit 524cda9 into trunk Sep 28, 2026
64 checks passed
@ciampo
ciampo deleted the codex/83611-storybook-postcss-browser branch September 28, 2026 22:08
@github-actions github-actions Bot added this to the Gutenberg 24.2 milestone Sep 28, 2026
widoz pushed a commit to widoz/gutenberg that referenced this pull request Oct 2, 2026
…3635)

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants