File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -137,8 +137,21 @@ function newRouter(): Router {
137
137
pageFilePath = pageFilePath . replace ( / \. j s $ / , '.lean.js' )
138
138
}
139
139
140
- if ( import . meta. env . SSR ) {
141
- pageModule = import ( /*@vite -ignore*/ pageFilePath + '?t=' + Date . now ( ) )
140
+ if ( import . meta. env . DEV ) {
141
+ pageModule = import ( /*@vite -ignore*/ pageFilePath ) . catch ( ( ) => {
142
+ // try with/without trailing slash
143
+ // in prod this is handled in src/client/app/utils.ts#pathToFile
144
+ const url = new URL ( pageFilePath ! , 'http://a.com' )
145
+ const path =
146
+ ( url . pathname . endsWith ( '/index.md' )
147
+ ? url . pathname . slice ( 0 , - 9 ) + '.md'
148
+ : url . pathname . slice ( 0 , - 3 ) + '/index.md' ) +
149
+ url . search +
150
+ url . hash
151
+ return import ( /*@vite -ignore*/ path )
152
+ } )
153
+ } else if ( import . meta. env . SSR ) {
154
+ pageModule = import ( /*@vite -ignore*/ `${ pageFilePath } ?t=${ Date . now ( ) } ` )
142
155
} else {
143
156
pageModule = import ( /*@vite -ignore*/ pageFilePath )
144
157
}
You can’t perform that action at this time.
0 commit comments