Skip to content

Commit

Permalink
fix: [V1 design] invalidate virtual modules upon removed/added + file
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jun 19, 2023
1 parent 7fe40eb commit 8e510da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions vite-plugin-ssr/TODO
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
- Check creation of +guard.js after dev start
- Removing =>
```
Failed to load url /pages/index/+guard.ts (resolved id: /home/rom/code/vite-plugin-ssr/examples/react-full-v1/pages/index/+guard.ts) in virtual:vite-plugin-ssr:importPageCode:server:/pages/index. Does the file exist?
```
- Optimize error
- If some Vite error swallowed => show DEBUG=vps:error hint
- Track config files imports
4 changes: 4 additions & 0 deletions vite-plugin-ssr/node/plugin/plugins/importUserCode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ function handleFileAddRemove(server: ViteDevServer, config: ResolvedConfig, conf
file = normalizePath(file)
const configName = getConfigName(file)
if (configName) {
const virtualModules = getVirtualModules(server)
virtualModules.forEach((mod) => {
server.moduleGraph.invalidateModule(mod)
})
reload(file, config, configVps, isRemove ? 'removed' : 'added')
}
}
Expand Down

0 comments on commit 8e510da

Please sign in to comment.