diff --git a/__tests__/e2e/dynamic-routes/[id].paths.ts b/__tests__/e2e/dynamic-routes/[id].paths.ts index 2874313f..48e35261 100644 --- a/__tests__/e2e/dynamic-routes/[id].paths.ts +++ b/__tests__/e2e/dynamic-routes/[id].paths.ts @@ -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'] diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts index 5a8dd3a0..955b4582 100644 --- a/src/node/plugins/dynamicRoutesPlugin.ts +++ b/src/node/plugins/dynamicRoutesPlugin.ts @@ -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() @@ -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(