Build the libraries before the storybook - #816
Merged
Merged
Conversation
The Netlify deploy failed with 'Rolldown failed to resolve import @commercelayer/core-components from packages/react-components/src/hooks/useCommerceLayer.ts'. The storybook's Vite config aliases @commercelayer/react-components straight to its source, so it looked like no prior build was needed. But that source imports @commercelayer/core-components, a workspace package whose entry point is ./dist/index.js — and nothing aliases it. On a clean checkout dist/ does not exist, so resolution fails. It passed locally only because dist/ was left over from earlier builds; deleting the three dist/ directories reproduces the Netlify error exactly, and pnpm build makes it pass again. Not a publishing problem: the dependency is declared as workspace:*, so pnpm links the local package and never consults the npm registry. The gh-pages workflow had the same latent bug — it also ran docs:build alone and would have failed identically on a clean runner.
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.
The Netlify deploy on #619 failed with:
Cause
The storybook's Vite config aliases
@commercelayer/react-componentsstraight to its source, which is why #815 assumed no prior build was needed. That assumption was wrong: the aliased source imports@commercelayer/core-components, a workspace package whose entry point is./dist/index.js, and nothing aliases that. On a clean checkoutdist/does not exist, so rolldown cannot resolve it.It passed locally only because
dist/was left over from earlier builds. Deleting the threedist/directories reproduces the Netlify failure exactly — same message, same file, exit 1 — andpnpm buildmakes it pass again.This is not about publishing to npm. The dependency is declared
"@commercelayer/core-components": "workspace:*", so pnpm links the local package and never consults the registry; the reproduction above happens with nothing published.Fix
pnpm build && pnpm docs:buildinnetlify.toml, and the same in thegh-pagesworkflow, which carried the identical latent bug — it also randocs:buildalone and would have failed the same way on a clean runner. It has just been re-armed with its push trigger, so it would have broken on the next push tomain.Verification
Simulating a clean checkout by deleting
packages/*/distand running the exact command Netlify will run:pnpm build && pnpm docs:build→ exit 0,packages/docs/storybook-staticproducedpnpm test— 998 passed / 24 skippedThe Netlify deploy preview on #619 remains the only real end-to-end signal; it will re-run once this lands on
v5.0.0.