fix, reload even when file is updated, to handle error fixes without reloading server

pull/4525/head
Divyansh Singh 7 months ago
parent f9b493b892
commit 25dcad1389

@ -49,6 +49,7 @@ interface ResolvedRouteModule {
} }
const dynamicRouteRE = /\[(\w+?)\]/g const dynamicRouteRE = /\[(\w+?)\]/g
const pathLoaderRE = /\.paths\.m?[jt]s$/
const routeModuleCache = new Map<string, ResolvedRouteModule>() const routeModuleCache = new Map<string, ResolvedRouteModule>()
let moduleGraph = new ModuleGraph() let moduleGraph = new ModuleGraph()
@ -148,7 +149,7 @@ export const dynamicRoutesPlugin = async (
} }
}, },
async hotUpdate({ file, modules: existingMods, type }) { async hotUpdate({ file, modules: existingMods }) {
if (this.environment.name !== 'client') return if (this.environment.name !== 'client') return
const modules = new Set<EnvironmentModuleNode>() const modules = new Set<EnvironmentModuleNode>()
@ -175,7 +176,7 @@ export const dynamicRoutesPlugin = async (
if ( if (
(modules.size && !normalizedFile.endsWith('.md')) || (modules.size && !normalizedFile.endsWith('.md')) ||
watchedFileChanged || watchedFileChanged ||
(type === 'create' && /\.paths\.m?[jt]s$/.test(normalizedFile)) pathLoaderRE.test(normalizedFile)
) { ) {
// path loader module or deps updated, reset loaded routes // path loader module or deps updated, reset loaded routes
Object.assign( Object.assign(

Loading…
Cancel
Save