fix(web): include tailwindcss plugin and gate loro-crdt regex alias for storybook#38536
Open
Harsh23Kashyap wants to merge 4 commits into
Open
fix(web): include tailwindcss plugin and gate loro-crdt regex alias for storybook#38536Harsh23Kashyap wants to merge 4 commits into
Harsh23Kashyap wants to merge 4 commits into
Conversation
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
6 tasks
Contributor
Author
|
Can someone take a look when you have a chance? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes for
pnpm storybook/pnpm storybook:buildfailures described in #38527. The Vite plugin pipeline that the Storybook dev server and build share was missing two pieces.1. Tailwind Vite plugin
The
isStorybookbranch inweb/vite.config.tsregistered onlyreact(), so@tailwindcss/postcssnever ran for the Storybook entry. CSS rules liketext-text-tertiary(declared inapp/styles/tailwind-core.css) were unknown during CSS processing and the preview stayed on the loading spinner. Addingtailwindcss()to the Storybook plugin list lets the existing pipeline process the shared Tailwind entry the same way the app does.2.
loro-crdtregex alias in Storybook buildresolve.aliasuses aRegExpfind (/^loro-crdt$/) so the dev server can maploro-crdtto its base64 build. The Storybook build runs through Rolldown viavite-plus, which only accepts stringfindvalues. The build fails withFailed 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
pluginsandoptimizeDepsfurther down the file (...(!isTest && !isStorybook ? ... : {})).Changes
web/vite.config.ts— includetailwindcss()in the Storybook plugin branch; gate theloro-crdtregex alias behind!isStorybook.Testing
pnpm exec eslint vite.config.ts— clean.pnpm exec tsc --noEmitparses the file with no diagnostics.pnpm test app/components/base/chat/chat/answer/__tests__/workflow-process.spec.tsxas a smoke check after install changes) — 13/13 pass.pnpm storybook/pnpm storybook:buildlocally — the package install hitpnpm updateresolution issues unrelated to this diff.Linked issue: closes #38527 once merged.