-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
Describe the bug
Similarly to #1974 (Ignore node_modules/
when running import.meta.glob
), import.meta.glob
searches inside dist/
.
This is problematic because:
- First
$ vite build
run generates files indist/
. - Second
$ vite build
run includes files insidedist/
of the previous build. - Third
$ vite build
run includes files of both the second and the first build.
This leads dist/
to grow indefinitely after each vite build
. This also leads to recursively growing bundle sizes.
Simply adding config.build.outDir
to fast-glob
's ignore
is not sufficient. For example, following builds don't know each other's config.build.outDir
:
$ vite build --ssrManifest --outDir dist/client
$ vite build --ssr src/entry-server.js --outDir dist/server
For the same reason, removing dist/
before $ vite build
isn't a solution either.
Instead, I'm proposing the more drastic but also more powerful solution #1986 - Programmatic definition of entries (alternatively to import.meta.glob
).
(The rest of the bug template is not applicable.)