-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[refactor] create ViteDevServer in dev function instead of in Watcher #3129
Conversation
|
b8617bc
to
016426b
Compare
016426b
to
6847f6d
Compare
6847f6d
to
9880a6c
Compare
9880a6c
to
9a1e958
Compare
…er doesn't depend on Vite
9a1e958
to
7b99623
Compare
could we use the watcher exposed by vite in server.watcher , accessible from configureServer hook? |
Unfortunately this is too far out of date since #2931 and would need to be redone. I'm not 100% sure what it's buying us, though? The dev service is comprised of two parts — a filewatcher, and a Vite server — and that's true whether they belong to a single class defined in
This isn't what's happening — the file system watcher and the server are both being created inside the |
yeah, that would make sense. I prefer |
Experimenting locally with using the Vite filewatcher. One wrinkle I've found: because Vite's own handlers are invoked first, if you delete a page you'll get an error in the console telling you that an import can't be resolved, because the manifest hasn't yet been updated to remove that import. Not sure if that's something we have any control over? |
I won't be mortally offended if SvelteKit stops using cheap-watch - it's had way more of an exciting life and way more npm downloads already than I ever expected it to. There was also an issue #2793 recently about allowing polling instead of filesystem events, and I think that could probably also be resolved if we were using Vite's own copy of Chokidar? |
|
Actually this seems unrelated — I can create the same error on |
My first commit on this PR made more sense, but the second one wasn't in a great state and then I had to go to bed. Thanks Rich for taking over on this one. I'll close in favor of #3138 |
It doesn't really make make sense for the server to be created inside the file system watcher. This makes them both be created in
dev
. The next step might be to see if we can create the watcher inside the Vite plugin. At that point, SvelteKit dev mode would really be doing nothing except for creating Vite config and plugin.