Skip to content
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

import.meta.glob searches in dist/ #1985

Closed
brillout opened this issue Feb 11, 2021 · 1 comment
Closed

import.meta.glob searches in dist/ #1985

brillout opened this issue Feb 11, 2021 · 1 comment

Comments

@brillout
Copy link
Contributor

Describe the bug

Similarly to #1974 (Ignore node_modules/ when running import.meta.glob), import.meta.glob searches inside dist/.

This is problematic because:

  1. First $ vite build run generates files in dist/.
  2. Second $ vite build run includes files inside dist/ of the previous build.
  3. 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.)

@yyx990803
Copy link
Member

I don't really consider this a bug, since it matches what matches the glob. The idea is you should only use glob patterns that are specific and ideally in a nested src directory.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants