fix(vite-plugin-admin): Ensure UI Routes are HMR (#7982)
* fix(vite-plugin-admin): Ensure UI Routes are HMR * cleanup
This commit is contained in:
committed by
GitHub
parent
b24c8503d5
commit
50df3cea00
@@ -695,28 +695,17 @@ export const medusaVitePlugin: MedusaVitePlugin = (options) => {
|
||||
* We also need to reload all modules that import the route.
|
||||
*/
|
||||
if (!_extensionGraph.has(file)) {
|
||||
const moduleId = getVirtualId(file)
|
||||
const resolvedModuleId = resolveVirtualId(moduleId)
|
||||
const module = server?.moduleGraph.getModuleById(resolvedModuleId)
|
||||
if (module) {
|
||||
await server?.reloadModule(module)
|
||||
}
|
||||
}
|
||||
|
||||
if (_extensionGraph.has(file)) {
|
||||
const modules = _extensionGraph.get(file)
|
||||
|
||||
if (!modules) {
|
||||
return
|
||||
}
|
||||
|
||||
for (const moduleId of modules) {
|
||||
const module = server?.moduleGraph.getModuleById(moduleId)
|
||||
const imports = new Set<string>()
|
||||
|
||||
for (const resolvedModuleId of RESOLVED_ROUTE_MODULES) {
|
||||
const module = server?.moduleGraph.getModuleById(resolvedModuleId)
|
||||
if (module) {
|
||||
imports.add(resolvedModuleId)
|
||||
await server?.reloadModule(module)
|
||||
}
|
||||
}
|
||||
|
||||
_extensionGraph.set(file, imports)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +802,6 @@ export const medusaVitePlugin: MedusaVitePlugin = (options) => {
|
||||
async load(id) {
|
||||
if (RESOLVED_WIDGET_MODULES.includes(id)) {
|
||||
const zone = getWidgetZone(id)
|
||||
|
||||
return register(id, { type: "widget", get: zone })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user