Currently virtual modules are only invalidated for the built in environments (client and ssr). The invalidateVirtualModules function needs to be updated to iterate over the environments when invalidating and use the module graph for each environment (viteDevServer.environments[environmentName].moduleGraph) rather than the shared module graph.
Currently virtual modules are only invalidated for the built in environments (client and ssr). The
invalidateVirtualModules
function needs to be updated to iterate over the environments when invalidating and use the module graph for each environment (viteDevServer.environments[environmentName].moduleGraph
) rather than the shared module graph.https://github.com/remix-run/remix/blob/d781cc3921d11c475ec40ac2afc02a49a22d10fc/packages/remix-dev/vite/plugin.ts#L308.