Manually invalidate virtual module #15504
Replies: 1 comment 2 replies
-
@benjaminpreiss I've been trying to hack together some something similar and here is what I came up with:
I'm sure there's lot's of dragons there, as it invalidates all modules. The main issue with the pattern I think you and I are both using is that we are introducing a virtual module which has hidden (in vite's eyes) dependencies on other files. Both the modules and server.moduleGraph from the HmrContext in the To solve this issue I'm thinking about injecting |
Beta Was this translation helpful? Give feedback.
-
I am building a library which adds virtual: module imports to specific files depending on a changing configuration file.
The problem is, that vite does detect changes in the configuration file / files imported from the configuration file but does not retrigger transforms in the virtual modules.
How can I make my vite plugin retrigger
transform
/load
when the configuration file changes?I was thinking there must be a cache invalidation option for specific files which I can call?
Very thankful for help.
Beta Was this translation helpful? Give feedback.
All reactions