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({
6
6
// console.log('watchedFiles', watchedFiles)
7
7
return paths
8
8
} ,
9
- watch : [ '** /data-loading/**/*.json' ] ,
9
+ watch : [ '.. /data-loading/**/*.json' ] ,
10
10
async transformPageData ( pageData ) {
11
11
// console.log('transformPageData', pageData.filePath)
12
12
pageData . title += ' - transformed'
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ export function createContentLoader<T = ContentData[]>(
95
95
96
96
async load ( files ?: string [ ] ) {
97
97
// 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
+ } )
99
102
100
103
const md = await createMarkdownRenderer (
101
104
config . srcDir ,
Original file line number Diff line number Diff line change @@ -308,7 +308,10 @@ async function resolveDynamicRoutes(
308
308
let pathsData : UserRouteConfig [ ]
309
309
310
310
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
+ } )
312
315
pathsData = await loader ( watchedFiles )
313
316
} else {
314
317
pathsData = loader
Original file line number Diff line number Diff line change @@ -97,7 +97,10 @@ export const staticDataPlugin: Plugin = {
97
97
}
98
98
99
99
// load the data
100
- const watchedFiles = await glob ( watch , options . globOptions )
100
+ const watchedFiles = await glob ( watch , {
101
+ absolute : true ,
102
+ ...options . globOptions
103
+ } )
101
104
const data = await load ( watchedFiles )
102
105
103
106
// 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'
3
3
import { normalizePath } from 'vite'
4
4
5
5
export interface GlobOptions {
6
+ absolute ?: boolean
6
7
cwd ?: string
7
8
ignore ?: string | string [ ]
8
9
dot ?: boolean
You can’t perform that action at this time.
0 commit comments