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

fix: do not cache module while the file contains import.meta.glob #3005

Merged
merged 1 commit into from
May 23, 2021

Conversation

ygj6
Copy link
Member

@ygj6 ygj6 commented Apr 15, 2021

Description

in #2734 , while source file(app.js) use import.glob.meta to scan /src/data/*.json,while we add a json file such as x.json,the module will hit cache in urlToModuleMap because the source file(app.js) did not change.

fix #2734

Additional context

@Niputi
Copy link
Contributor

Niputi commented Apr 15, 2021

tests are not successful

@ygj6
Copy link
Member Author

ygj6 commented Apr 17, 2021

@Niputi This error does not seem to be caused by my submission

@Niputi
Copy link
Contributor

Niputi commented Apr 17, 2021

could you try rebasing against main?

@ygj6
Copy link
Member Author

ygj6 commented Apr 19, 2021

@Niputi done

@antfu
Copy link
Member

antfu commented May 7, 2021

Personally don't think this is the best way to solve the problem. Introduce fs operations and disable the cache could have certain impact to the pref. Better to track the dependencies and invalid the module on deps changes properly instead.

@ygj6
Copy link
Member Author

ygj6 commented May 10, 2021

@antfu Thanks for your suggestion. I re-examined the source code and found that this problem was caused by the invalidate method does not consider the ssr module. I revised it again, please take a look. Thank you very much!

@ygj6 ygj6 marked this pull request as ready for review May 11, 2021 06:16
Copy link

@Schniz Schniz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change works well for my use cases!
Thank you. Let's hope it will be merged soon.

@Shinigami92 Shinigami92 added feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority) labels May 20, 2021
@Shinigami92 Shinigami92 requested a review from antfu May 20, 2021 08:21
@antfu antfu merged commit e7b8f41 into vitejs:main May 23, 2021
ygj6 added a commit to ygj6/vite that referenced this pull request Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSR import.meta.glob does not update on file/directory add/remove
7 participants