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: Pre-transform error: Module is disposed #1416

Open
PierreGUI opened this issue Jul 2, 2024 · 1 comment
Open

[Regression] Vite: Pre-transform error: Module is disposed #1416

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

Comments

@PierreGUI
Copy link

Environment

  • Linaria version: 6.2.0
  • wyw-in-js version: 0.5.0
  • Bundler (+ version): Vite 5.3.2
  • Node.js version: 18.17.1
  • OS: MacOS 14.4.1

Description

I'm unable to reproduce in a smaller repo, this seems to be affecting large codebases.
I used to build my Remix project with Vite in Linaria 6.1.0, but this error starts appearing since version 6.2.0. I'm aware the new linaria version comes with a bunch of @wyw-in-js updates too, but I tried the latest wyw packages with the older Linaria version and it still appears to build fine.

This is an sample of the many errors I get:

[vite] Pre-transform error: Module 00312 is disposed in/src/components/clients/songs/JamSessions.redux.ts
| /src/components/clients/artists/SongsHeader.view.tsx

[vite] Error when evaluating SSR module /src/components/clients/artists/SongsPresenter.view.tsx:
|- /node_modules/@wyw-in-js/transform/lib/module.js:223
      throw new EvalError(`${e.message} in${this.callstack.join('\n| ')}\n`);
      ^

EvalError: Module 00312 is disposed in/src/components/clients/songs/JamSessions.redux.ts
| /src/components/clients/artists/SongsHeader.view.tsx

    at Module.evaluate (/node_modules/@wyw-in-js/transform/lib/module.js:223:13)
    at require.Object.assign.ensure (/node_modules/@wyw-in-js/transform/lib/module.js:117:7)
    at /src/components/clients/artists/SongsHeader.view.tsx:11:43
    at /src/components/clients/artists/SongsHeader.view.tsx:118:3
    at Script.runInContext (node:vm:135:12)
    at Module.evaluate (/node_modules/@wyw-in-js/transform/lib/module.js:208:14)
    at evaluate (/node_modules/@wyw-in-js/transform/lib/evaluators/index.js:14:5)
    at BaseAction.evalFile (/node_modules/@wyw-in-js/transform/lib/transform/generators/evalFile.js:35:43)
    at evalFile.next (<anonymous>)
    at /node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:66:78
    at EventEmitter.action (/node_modules/@wyw-in-js/transform/lib/utils/EventEmitter.js:25:22)
    at BaseAction.emitAction (/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:131:39)
    at nextFn (/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:66:32)
    at processNext (/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:111:28)
    at Object.next (/node_modules/@wyw-in-js/transform/lib/transform/actions/BaseAction.js:120:9)
    at asyncActionRunner (/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:39:102)
    at asyncActionRunner (/node_modules/@wyw-in-js/transform/lib/transform/actions/actionRunner.js:46:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async transform (/node_modules/@wyw-in-js/transform/lib/transform.js:107:20)
    at async TransformPluginContext.transform (file:///node_modules/@wyw-in-js/vite/esm/index.mjs:117:22)
    at async PluginContainer.transform (file:///node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:49587:18)
    at async loadAndTransform (file:///node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:52409:27)
    at async Proxy.warmupRequest (file:///node_modules/vite/dist/node/chunks/dep-C1-ZB6nQ.js:63130:9)

Noticed it affects .redux files where I use react-redux's connect HoC, which kinda reminds me of #1226

Reproducible Demo

I am unfortunately unable to make one atm, but I'm still trying to. Any help or hint is welcome 🙏

@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 2, 2024
@github-actions github-actions bot added platform: ssr 🛠️ Issue related to SSR and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Jul 2, 2024
@PierreGUI
Copy link
Author

PierreGUI commented Jul 31, 2024

Based on #1352 I added useWeakRefInEval: false to my wyw config and it seems to help ✨

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 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