Skip to content

Conversation

@pixelflips
Copy link
Member

@pixelflips pixelflips commented Dec 5, 2025

Description

After upgrading Storybook from version 8 to 10, the live reload (HMR) feature stopped working correctly for component code changes. Style changes would reload, but changes to .tsx and .ts files required manually restarting the Storybook server.

The root cause was the Vite watch configuration in .storybook/main.js. The previous config ignored **/components/** and **/dist/** which prevented Vite from detecting changes in source files and built output.

Changes:

  • Remove **/components/** from ignored to watch src/components/**
  • Remove blanket **/dist/** ignore, only ignore unused subdirectories
  • Keep watching dist/docs.json and dist/collection/** for Stencil rebuilds
  • Enable HMR overlay for better developer feedback

This restores the expected live reload behavior when making component code changes.

Fixes DSS-31

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • unit tests
  • e2e tests
  • accessibility tests
  • tested manually
  • other:

Steps to reproduce:

  1. Run npm run start to start both Stencil and Storybook
  2. Navigate to any component story (e.g., Alert)
  3. Make a code change to the component's .tsx file
  4. Verify that Storybook reloads and reflects the change without manual restart

Test Configuration:

  • Pine versions: 3.11.1
  • OS: macOS
  • Browsers: Chrome
  • Screen readers:
  • Misc:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Design has QA'ed and approved this PR

The previous config ignored **/components/** and **/dist/** which prevented
Vite from detecting changes in source files and built output.

Changes:
- Remove **/components/** from ignored to watch src/components/**
- Remove blanket **/dist/** ignore, only ignore unused subdirectories
- Keep watching dist/docs.json and dist/collection/** for Stencil rebuilds
- Enable HMR overlay for better developer feedback

This fixes live reload not working for component code changes after
upgrading to Storybook 10 with Vite.
@pixelflips pixelflips self-assigned this Dec 5, 2025
@netlify
Copy link

netlify bot commented Dec 5, 2025

Deploy Preview for pine-design-system ready!

Name Link
🔨 Latest commit 6d3b495
🔍 Latest deploy log https://app.netlify.com/projects/pine-design-system/deploys/69322c1498a14a00083c6050
😎 Deploy Preview https://deploy-preview-603--pine-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added bug Something isn't working package: core Changes have been made to the Core package labels Dec 5, 2025
@pixelflips pixelflips marked this pull request as ready for review December 5, 2025 00:50
@pixelflips
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

📝 Walkthrough

Walkthrough

The changes refine the Vite and Storybook integration configuration in the build system. The file watching strategy is modified to selectively ignore specific directories (loader, www, node_modules, coverage, and certain dist subdirectories) while explicitly including dist/docs.json and dist/collection/** in the watch list. The configuration adds an error overlay for Hot Module Replacement and disables polling in favor of native file system events. These adjustments affect file-watching and live-reload behavior without modifying core story loading logic.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: updating Vite watch config to fix HMR live reload in Storybook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description follows the template structure with all required sections completed: summary with issue reference (Fixes DSS-31), type of change (bug fix), testing approach (manual), and checklist items addressed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/storybook-vite-hmr-watch-config

Comment @coderabbitai help to get the list of available commands and usage tips.

@pixelflips pixelflips merged commit b30a13e into main Dec 5, 2025
23 of 26 checks passed
@pixelflips pixelflips deleted the fix/storybook-vite-hmr-watch-config branch December 5, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package: core Changes have been made to the Core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants