File tree Expand file tree Collapse file tree 5 files changed +14
-4
lines changed
__tests__/e2e/dynamic-routes Expand file tree Collapse file tree 5 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default defineRoutes({
66 // console.log('watchedFiles', watchedFiles)
77 return paths
88 } ,
9- watch : [ '** /data-loading/**/*.json' ] ,
9+ watch : [ '.. /data-loading/**/*.json' ] ,
1010 async transformPageData ( pageData ) {
1111 // console.log('transformPageData', pageData.filePath)
1212 pageData . title += ' - transformed'
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ export function createContentLoader<T = ContentData[]>(
9595
9696 async load ( files ?: string [ ] ) {
9797 // the loader is being called directly, do a fresh glob
98- files = files ?? ( await glob ( watch , options . globOptions ) )
98+ files ??= await glob ( watch , {
99+ absolute : true ,
100+ ...options . globOptions
101+ } )
99102
100103 const md = await createMarkdownRenderer (
101104 config . srcDir ,
Original file line number Diff line number Diff line change @@ -308,7 +308,10 @@ async function resolveDynamicRoutes(
308308 let pathsData : UserRouteConfig [ ]
309309
310310 if ( typeof loader === 'function' ) {
311- const watchedFiles = await glob ( watch , options . globOptions )
311+ const watchedFiles = await glob ( watch , {
312+ absolute : true ,
313+ ...options . globOptions
314+ } )
312315 pathsData = await loader ( watchedFiles )
313316 } else {
314317 pathsData = loader
Original file line number Diff line number Diff line change @@ -97,7 +97,10 @@ export const staticDataPlugin: Plugin = {
9797 }
9898
9999 // load the data
100- const watchedFiles = await glob ( watch , options . globOptions )
100+ const watchedFiles = await glob ( watch , {
101+ absolute : true ,
102+ ...options . globOptions
103+ } )
101104 const data = await load ( watchedFiles )
102105
103106 // record loader module for HMR
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { glob as _glob } from 'tinyglobby'
33import { normalizePath } from 'vite'
44
55export interface GlobOptions {
6+ absolute ?: boolean
67 cwd ?: string
78 ignore ?: string | string [ ]
89 dot ?: boolean
You can’t perform that action at this time.
0 commit comments