Repository navigation
perf(storybook): improve deployed build performance - #280
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves deployed Storybook performance by removing a broken deploy-only CSS request, re-enabling more cache-friendly Storybook build outputs, and adding deployment/build reporting tooling to track regressions.
Changes:
- Remove the deploy-time
../src/styles/global.csslink from Storybook’spreview-head.htmlwhile keeping the runtime CSS import in preview. - Restore more cacheable Storybook build output (hashed assets) and remove the explicit Rollup treeshaking disable.
- Add Netlify cache headers for HTML vs. immutable hashed assets, plus a CLI script to report Storybook build size.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
scripts/report-storybook-build.mjs |
Adds a repeatable build-size reporting script (total size, JS count/bytes, top assets). |
scripts/inject-preview-head.js |
Updates post-build head normalization messaging for index.html / iframe.html. |
package.json |
Adds storybook-report script entry. |
netlify.toml |
Adds cache headers: revalidate HTML, long-cache immutable /assets/*. |
.storybook/preview-head.html |
Removes deploy-only broken CSS <link> request. |
.storybook/main.ts |
Restores hashed asset naming and removes explicit treeshake: false. |
.gitattributes |
Extends whitespace attribute checks to *.js, *.mjs, and *.json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
../src/styles/global.csswhile keeping the runtime preview CSS import.Closes #273
Review scope
Type of change
Workflow gates
Closes #NNNor maintainer approved an exception.status:approvedbefore implementation starts.In progress, branch/worktree recorded.<type>(<optional scope>): <description>..playwright-mcp,page-*.png,page-*.jpeg,*.md.playwright-output.Component evidence (required for component changes)
types.ts,use*.ts,Component.tsx,Component.test.tsx,Component.stories.tsx,index.ts.types.ts; JSX component has no state, CVA calls, or business logic.@defaultJSDoc intypes.ts(node scripts/verify-prop-default-docs.mjs).theme.css; no hardcoded colors or arbitrary color utilities.N/A — no component runtime changes.
Accessibility evidence
N/A — no component behavior or accessibility contract changed. Storybook a11y addon remains enabled.
Validation evidence
pnpm exec tsc --noEmit✅pnpm testvia pre-push hook ✅ — 35 files / 745 tests passedpnpm run storybook-build✅pnpm run storybook-report✅../src/styles/global.cssreference ✅.storybook/preview.tsx✅-531,833,-5.63%)Screenshots or recordings
N/A — config/build change. Deploy smoke check should verify headers and network requests on the Netlify preview.
Notes for reviewer
/,/index.html,/iframe.html, and one hashed/assets/*file.status:approved, assignee, and ProjectIn progresswere updated before opening this PR.