Using vite-plugin-solid with vitest workspaces prevents solid-js from resolving correctly
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript, vite
- Ambito
- build-system, testing
Direzione di ricerca
Inizia con la riproduzione StackBlitz collegata ed esegui npm run test-all, quindi confrontala con npm run test-fe-only e npm run test-all-no-plugin. Esamina come vite-plugin-solid interagisce con i workspace di Vitest e la risoluzione di solid-js mostrata in node_modules/solid-js/store/dist/dev.js. Il lavoro è completato quando il test del workspace che chiama createStore non genera più un'eccezione mentre il plugin rimane abilitato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Vitest has a workspaces feature, where vitest can be made aware of different sub-projects, and run the tests for each of these workspaces (based on their individual configuration) together.
However, when using Vitest workspaces and vite-plugin-solid, the solid-js resolution system fails to work properly, and functions like createStore() throw errors.
Reproduction
https://stackblitz.com/edit/solidjs-templates-4usktg?file=README.md&view=editor
The problem can be reproduced by running npm run test-all in the console. This runs a test that just calls createStore.
Running npm run test-fe-only runs vitest in the frontend/ package, which bypasses Vitest's workspaces system, everything works again.
Running npm run test-all-no-plugin runs vitest the same as in test-all, but with the vite-plugin-solid plugin disabled. Again, this works as expected.
Error/Investigation
The error returned is:
TypeError: Cannot read properties of undefined (reading 'registerGraph')
❯ Module.createStore node_modules/solid-js/store/dist/dev.js:213:9
❯ packages/frontend/src/test.spec.ts:6:36
This is because in dev-mode, the createStore tries to access the DEV object exported by solid-js. This DEV object is only available if solid-js is running in dev mode (in production, a different file is used which sets DEV to undefined).
However, for some reason, when Vite/NodeJS/Vitest/? tries to resolve the import solid-js from node_modules/solid-js/store/dist/dev.js, it instead imports the production version of solid-js, which obviously doesn't have the correct exported DEV object, and so an error is thrown.
I'm creating this issue here, because the error only occurs if vite-plugin-solid is installed, but I'm not entirely sure what this plugin is doing that makes things behave weirdly here. There isn't any JSX to process, so I would have through the plugin is essentially a no-op.
Thanks for any help!
- Lingua principale
- TypeScript
- Stelle
- 520
- Fork
- 70
- Merge medio
- 23h 35m
- PR unite (30g)
- 39
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di solidjs/solid-vite-plugin
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
solidjs/solid-vite-plugin#205 · 1 commento · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
solidjs/solid-vite-plugin#369 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
solidjs/solid-vite-plugin#328 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
solidjs/solid-vite-plugin#308 ·
-
jsx: 'preserve' in optimizeDeps breaks dependency scan when .tsx files use `import.meta.glob` Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
solidjs/solid-vite-plugin#262 · 2 commenti ·
Tutte le issue di solidjs/solid-vite-plugin
Issue simili
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Add 2021 Cup data to website Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
chrisparsons83/flexspotff#153 ·