Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] Vite Internal server error: Soft-invalidated module #91

Open
PierreGUI opened this issue Jul 1, 2024 · 2 comments
Open
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked cat: performance 🚀 Issue is related to performance needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR

Comments

@PierreGUI
Copy link

PierreGUI commented Jul 1, 2024

Environment

  • wyw-in-js version: ^0.5.1 (Linaria 6.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.

@PierreGUI PierreGUI added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Jul 1, 2024
@github-actions github-actions bot added platform: ssr 🛠️ Issue related to SSR cat: performance 🚀 Issue is related to performance and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Jul 1, 2024
@PierreGUI
Copy link
Author

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)

@PierreGUI
Copy link
Author

PierreGUI commented Jul 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked cat: performance 🚀 Issue is related to performance needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR
Projects
None yet
Development

No branches or pull requests

1 participant