-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
importing sqlite3 fails in dev mode #3118
Comments
The core issue might be the same as #3053, but the stack trace looks new to me. I'm starting to think that Vite shouldn't interfere with Node's internal stuff, as you've found in vitejs/vite#3951. I haven't got the bottom of fixing that yet, but I'm feeling we should revert that. |
@lovasoa Can you provide a smaller repro for sqlite3 only? There's a lot going on in your project it was tricky to track it down. |
@bluwy : I tried, but the bug is quite hard to reproduce in a minimal context. It seems to be dependent on the order of compilation of different modules. To help you with debugging, I created a new branch in my repo with a test endpoint: https://github.com/lovasoa/sanipasse/tree/reproduction-sveltekit-bug-3118 https://github.com/lovasoa/sanipasse/blob/reproduction-sveltekit-bug-3118/src/routes/api/test.ts If you load this endpoint first immediately after starting the dev server, then the code is compiled correctly and the application will work correctly for the entire lifetime of the dev server. If you first load an other page ( The following fails:
The following works:
|
@bluwy Okay, knowing this load order issue, I could reproduce the issue in a minimal context : |
Did you undertand how exactly this happens? |
No, I didn't dig deep enough to understand how this happens. Sorry ! |
@lovasoa An update, it's the weekdays again so I'm a bit busy, but I'll try to take a look when I have the time. But big thanks for the smaller reproduction, that would help a lot when debugging. |
I've sent a fix at vitejs/vite#6488 |
Closing this as vitejs/vite#6488 has been merged. Once that is released, you can update SvelteKit's Vite version to that new version. |
Hey, the problem still persists in the latest version of kit. I think it's fair to close this issue only after vitejs version is updated on kit, since it's not a peer dependency. |
@ceifa Vite 2.8.0-beta.3 is out with the fix. You can force to that version with npm overrides, yarn resolutions, or pnpm overrides. But if the beta has other issues, perhaps I can check with the Vite team to release the fix under 2.7.x, but so far vite-ecosystem-ci for svelte is passing. |
How would you do this in your package.json? |
How would you do this in your package.json? |
@kudadam @uc-anr I've already linked the relevant docs. Here's the answer: {
"name": "blabla",
"overrides": {
"vite": "^2.8.0-beta.5"
}
} |
I did the same thing but the error continues to pop up |
Can you please clearly share some doc where it is used as we are getting this issues continuously after that also. |
Did y'all run |
{ Above is my package.json pls check. |
Describe the bug
A recent update to sveltekit broke the usage of sqlite3 in server-side code.
When using npm's sqlite3 module in server-side code and running the code in development mode, the import fails with
Reproduction
use sqlite3 in a svelte hook, and run the code with
svelte-kit dev
Reproducible in https://github.com/lovasoa/sanipasse/tree/5f4a3d5177c88462b2bee2c029eeb7534155cdb2
Logs
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: