-
Notifications
You must be signed in to change notification settings - Fork 322
Description
Describe the bug
Problem
If the project contains a huge directory or symlinks to a huge directory, a "hello world" project can take ~45 seconds or even minutes to launch vite dev
.
Vite supports ignoring directories through the server.watch.ignore
option. The Vanilla Extract compiler doesn't pass it through. The parent process starts quickly but chokes as it waits for the child compiler to initialize.
Note
There appears to be a race condition. I can repro this ~75% of the time with bun
, and almost never with node
. Maybe it has something to do with load order?
Example
I ran into this because I use Nix and direnv, although the bug isn't specific to either tool. It creates a .direnv/
directory which includes a symlink to nixpkgs. It's a big honkin' repo with ~50k files.
I can ignore that directory just fine (instant startup) until I add @vanilla-extract/vite-plugin
. Then everything slows to a crawl.
import { defineConfig } from 'vite';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
export default defineConfig({
plugins: [vanillaExtractPlugin()],
server: {
watch: {
ignored: ['**/.direnv/**'], // Not respected by vanilla extract.
},
},
});
This happens for any large directory or symlink not covered by the default ignore patterns.
Hacky Workaround
No reasonable workarounds, but I am able to post-install patch node modules here passing viteConfig.server.watch.ignored
, here, and here. That restores consistent 500ms startup time.
Reproduction
https://github.com/PsychoLlama/vanilla-extract-ignored-patterns-issue-repro
System Info
System:
OS: Linux 6.12 cpe:/o:nixos:nixos:25.05 25.05 (Warbler)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 24.43 GB / 38.84 GB
Container: Yes
Shell: 0.106.1 - /nix/store/7pn92hjbp0c3jn4p0jvbjisddvx9y6fp-nushell-0.106.1/bin/nu
Binaries:
bun: 1.2.23 - /tmp/bun-node-cf1367137/bun
npmPackages:
@vanilla-extract/vite-plugin: ^5.1.1 => 5.1.1
vite: ^7.1.9 => 7.1.9
Used Package Manager
bun
Logs
VITE v7.1.9 ready in 52117 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.