-
-
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
Cannot find module @sveltejs/kit/hooks
in dev server
#2237
Comments
This comment has been minimized.
This comment has been minimized.
Vite seems to be looking for a Node package named Sounds similar to vitejs/vite#3953 and possibly ultimately caused by browserify/resolve#222 It works better if you do |
@benmccann doesn't work and fails with the following:
|
@benmccann I've just tried manually adding Is there any reason why we don't already do this? Reading the Vite docs this is the behaviour we want, right? For Vite to not try to use a (nonexistant?) CJS export? Am I missing something? We're already excluding svelte dependencies, just not Kit. Vite notes that the heuristic will likely get better, but that for now you might need to manually include and exclude packages. I suggest that we add this at least until vitejs/vite#3953 is closed. The option is marked as Experimental by Vite, but we're already using it so ¯\_(ツ)_/¯ If that sounds good I can whip up a PR tomorrow. |
It looks like it's automatically externalized because it's in I don't know why Vite treats |
@benmccann FWIW the fact Vite treats Most of my packages are in All the Each time I try to create a minimal reproduction example I struggle to reproduce it but maybe 3rd (or 10th) time is the charm. I've been trying to follow as much Vite/SvelteKit activity as possible and take a fresh look when it looks like things have changed (hopefully 2 steps forward and no steps back :)).
Sorry for the long ramble, but in short, I'm interested in what you find out with Vite regarding |
I have a PR out to fix this: vitejs/vite#4699 |
Still appears to be happening after the 1.0.0-next.159 release. I just created a brand-new project and did
|
My bad! I somehow managed to change |
Can confirm that the 1.0.0-next.160 release fixes it. Thanks! |
I'm seeing same error (ref: https://stackoverflow.com/questions/69113480/sveltekit-cannot-find-module-swiper ) using "version": "1.0.0-next.165", Not sure its the same exact root cause, but clearly
|
@zipzit this is a completely different issue, which are open issues about. Just search for "swiper". |
The same error: |
Describe the bug
When trying to use the newly merged
sequence
from@sveltejs/kit/hooks
the dev server fails to load the module (and therefore fails to run any hooks).Adapter-node, however, functions properly and chains the hooks (which also means it's not just a dependency installation issue).
Reproduction
Reproduction repo: https://github.com/Karlinator/reproduction-sveltekit-hooks
As stated, this bug applies (as far as I can tell) only in dev mode. Haven't tested any other adapters than node, but that works.
Logs
System Info
Severity
serious, but I can work around it
Additional Information
Currently working around by either compiling with adapter-node during development or just not using
sequence
.The text was updated successfully, but these errors were encountered: