re-resolve pages on path loader file creation

pull/4525/head
Divyansh Singh 7 months ago
parent 689984da34
commit f9b493b892

@ -2,7 +2,7 @@ import paths from './paths'
export default {
async paths(watchedFiles: string[]) {
// console.log('watchedFiles', watchedFiles)
console.log('watchedFiles', watchedFiles)
return paths
},
watch: ['**/data-loading/**/*.json']

@ -148,7 +148,7 @@ export const dynamicRoutesPlugin = async (
}
},
async hotUpdate({ file, modules: existingMods }) {
async hotUpdate({ file, modules: existingMods, type }) {
if (this.environment.name !== 'client') return
const modules = new Set<EnvironmentModuleNode>()
@ -174,7 +174,8 @@ export const dynamicRoutesPlugin = async (
if (
(modules.size && !normalizedFile.endsWith('.md')) ||
watchedFileChanged
watchedFileChanged ||
(type === 'create' && /\.paths\.m?[jt]s$/.test(normalizedFile))
) {
// path loader module or deps updated, reset loaded routes
Object.assign(

Loading…
Cancel
Save