Loading...
Loading...
March 23, 2026
While migrating a production-grade monorepo to Storybook 10 and Vite 6, I encountered a critical blocker: Storybook would start, but the preview iframe remained stuck on a loading spinner. The console was littered with a cryptic error: GET.../@id/__x00__/@id/__x00__virtual:/@storybook/builder-vite/vite-app.js 404 (Not Found).
This wasn’t just a missing file. It was a breakdown in how the build tool (Vite) and the package manager (pnpm) communicated within a complex workspace.
My objective was to stabilize the development environment and ensure that UI components in packages/ui could be isolated and tested within apps/storybook. The challenge was three-fold:
ERR_INSUFFICIENT_RESOURCES flood causing 27,000+ failed requests.Standard fixes like “clear your cache” failed because we were fighting Resolution Persistence—a state where Vite’s internal module graph and the browser’s Service Worker “memorize” a failure and serve it back even after a code fix. I implemented a multi-layered solution:
Research confirmed that pnpm’s strict nested symlink structure can cause Vite to “double-wrap” virtual IDs in monorepos. I transitioned the workspace to a Hoisted Linker by adding node-linker=hoisted to the .npmrc. This provided the flat node_modules structure that Storybook’s Vite builder expects while maintaining pnpm’s disk efficiency.
Vite 6.1.0 introduced stricter resolution for HMR dependencies that triggered a 404 regression in Storybook 10. I pinned Vite to 6.0.9, a known stable version for this stack. In the configuration, I disabled preTransformRequests to stop the server-side analyzer from proactively mangling virtual module IDs before they were requested.
A crucial discovery was a component-level infinite loop. The console showed 27,450 errors—net::ERR_INSUFFICIENT_RESOURCES—indicating that a component was exhausting the browser’s connection limit by spamming GraphQL requests. I audited the hooks to ensure proper dependency arrays were in place, clearing the “network clog” that was preventing critical files from loading.
With the move to the modern ESM toolchain, legacy Sass functions like lighten() were throwing deprecation errors. I refactored the design token system to use the new sass:color API, ensuring a clean, warning-free build.
After a “Nuclear Reset” of the browser’s Service Worker and a clean install, the environment stabilized:
npx storybook doctor reported a perfectly healthy project..tsx, I eliminated parser crashes that occurred when moving to ESM-only Storybook 10.To ensure this “Persistence Paradox” never returns, I implemented three preventative measures:
predev script to automatically wipe the server-side resolution cache (node_modules/.cache/storybook) before every run..tsx to comply with Vite’s strict JSX parsing, avoiding silent crashes in the build pipeline.