wyw-in-js
wyw-in-js copied to clipboard
[Regression] Vite Internal server error: Soft-invalidated module
Environment
- wyw-in-js version:
^0.5.1(Linaria6.1.0) - Bundler (+ version): Vite
5.3.2 - Node.js version:
18.17.1 - OS: MacOS
14.4.1
Description
Sorry the description is vague. I can hardly understand what's going on, neither can I isolate the problem. Please let me know what extra info you'd like me to add.
I'm migrating a big codebase to React + Remix with Vite.
I could build my project just fine with @wyw-in-js/[email protected] but starting from 0.5.1 I'm getting a lot of errors at build time "Pre-transform error: Internal server error: Soft-invalidated module should not have existing transform result"
Here's a sample of the output (it goes on and on and on...):
...
[vite] hmr update /src/components/clients/setlists/Card.view.wyw-in-js.css
[vite] hmr update /src/components/clients/setlists/Card.view.wyw-in-js.css (x2)
[vite] Internal server error: Internal server error: Soft-invalidated module "/src/theme/chords/Button.tsx" should not have existing transform result
at handleModuleSoftInvalidation (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52474:11)
at getCachedTransformResult (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52329:58)
at doTransform (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52287:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async viteTransformMiddleware (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:62168:24)
[vite] hmr update /src/components/clients/setlists/SetlistPlaceholder.view.wyw-in-js.css
[vite] hmr update /src/components/clients/channels/SummaryPresenter.view.wyw-in-js.css
[vite] page reload client/src/theme/songs/MusicCard.wyw-in-js.css
[vite] hmr update /src/components/clients/songs/LinksList.view.wyw-in-js.css
[vite] hmr update /src/theme/chords/IconButton.wyw-in-js.css
[vite] hmr update /src/components/clients/setlists/Card.view.wyw-in-js.css
[vite] hmr update /src/theme/songs/MusicCard.wyw-in-js.css
[vite] hmr update /src/components/shared/Toasts.wyw-in-js.css
[vite] hmr update /src/theme/chords/IconButton.wyw-in-js.css
[vite] Pre-transform error: Internal server error: Soft-invalidated module "/src/theme/chords/IconButton.tsx" should not have existing transform result
[vite] hmr update /src/components/clients/setlists/Card.view.wyw-in-js.css
...
[vite] Pre-transform error: Internal server error: Soft-invalidated module "/src/components/clients/modals/Login.redux.ts" should not have existing transform result
...
Note with version 0.5.0 there's no hmr update in the console output
Worth mentioning the error doesn't affect the same component as the build process is restarted, might as well be random.
Possibly related, sometimes Vite throws this error. Usually gone after restart.
15:15:51 [vite] Internal server error: Internal server error: Soft-invalidated module "/src/components/clients/setlists/AddButton.redux.ts" should not have existing transform result
at handleModuleSoftInvalidation (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52474:11)
at getCachedTransformResult (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52329:58)
at doTransform (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52287:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async viteTransformMiddleware (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:62168:24)
15:15:51 [vite] page reload client/src/theme/notes/Icons.wyw-in-js.css
15:15:51 [vite] Error when evaluating SSR module /src/components/clients/navigate/ResponsiveBar.view.tsx: failed to import "/src/components/clients/navigate/Presenter.view.tsx"
|- Error: [vite] The dependency module is not yet fully initialized due to circular dependency. This is a bug in Vite SSR
at ssrImport (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:53400:19)
at eval (client/src/components/clients/navigate/ResponsiveBar.view.tsx:5:37)
at async instantiateModule (file://client/node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:53451:5)
Hey there! I've managed to reproduce in a sandbox: https://stackblitz.com/edit/remix-run-remix-hgufru?file=app%2Froutes%2F_index.tsx
Sorry it's a bit of a mess, I can't narrow it down more, mostly because it's flaky: you need to restart the server multiple times to see it happen:
Kapture 2024-07-30 at 17.43.30.webm
In my codebase I get multiple of these errors consistently, although I noticed the errors don't originate from the same files every time (so it's still sort of flaky).
Took me a long time so I hope this helps. I'm desperate to get any hint from you about what this is about. Thanks
I'm having the same problem, with 0.6.0 and linaria 6.3.0.