Skip to content

fix(web): include tailwindcss plugin and gate loro-crdt regex alias for storybook#38536

Open
Harsh23Kashyap wants to merge 4 commits into
langgenius:mainfrom
Harsh23Kashyap:fix/38527-storybook-vite-plugins
Open

fix(web): include tailwindcss plugin and gate loro-crdt regex alias for storybook#38536
Harsh23Kashyap wants to merge 4 commits into
langgenius:mainfrom
Harsh23Kashyap:fix/38527-storybook-vite-plugins

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor

Summary

Two fixes for pnpm storybook / pnpm storybook:build failures described in #38527. The Vite plugin pipeline that the Storybook dev server and build share was missing two pieces.

1. Tailwind Vite plugin

The isStorybook branch in web/vite.config.ts registered only react(), so @tailwindcss/postcss never ran for the Storybook entry. CSS rules like text-text-tertiary (declared in app/styles/tailwind-core.css) were unknown during CSS processing and the preview stayed on the loading spinner. Adding tailwindcss() to the Storybook plugin list lets the existing pipeline process the shared Tailwind entry the same way the app does.

2. loro-crdt regex alias in Storybook build

resolve.alias uses a RegExp find (/^loro-crdt$/) so the dev server can map loro-crdt to its base64 build. The Storybook build runs through Rolldown via vite-plus, which only accepts string find values. The build fails with Failed to convert builtin plugin 'ViteAlias': StringExpected. Guard the regex alias so it only applies outside Storybook mode — the alias exists to work around a wasm loader incompatibility that Storybook does not need.

Why this belongs

The issue text describes the exact symptoms and proposes a near-identical fix for the Tailwind branch. The alias guard is a small addition that follows the same condition shape used by plugins and optimizeDeps further down the file (...(!isTest && !isStorybook ? ... : {})).

Changes

  • web/vite.config.ts — include tailwindcss() in the Storybook plugin branch; gate the loro-crdt regex alias behind !isStorybook.

Testing

  • pnpm exec eslint vite.config.ts — clean.
  • pnpm exec tsc --noEmit parses the file with no diagnostics.
  • Verified on the test suite (used pnpm test app/components/base/chat/chat/answer/__tests__/workflow-process.spec.tsx as a smoke check after install changes) — 13/13 pass.
  • Could not run pnpm storybook / pnpm storybook:build locally — the package install hit pnpm update resolution issues unrelated to this diff.

Linked issue: closes #38527 once merged.

Without tailwindcss() in the isStorybook plugin branch, semantic
utilities like 'text-text-tertiary' are unknown during Storybook CSS
processing, leaving the preview stuck on a loading state.

Fixes langgenius#38527
The Storybook build pipeline (Rolldown via vite-plus) only accepts
string 'find' values in resolve.alias and rejects the regex form used
by the Vite dev server, so 'pnpm storybook:build' fails with a
'StringExpected' error. Guard the regex alias so it only applies
outside the Storybook mode that the issue reporter hit.

Fixes langgenius#38527
@Harsh23Kashyap Harsh23Kashyap requested a review from iamjoel as a code owner July 8, 2026 05:30
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 8, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 8, 2026
@Harsh23Kashyap

Copy link
Copy Markdown
Contributor Author

Can someone take a look when you have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm storybook / pnpm storybook:build error, The tailwindcss plugin is missing (Cannot apply unknown utility class)

1 participant