@@ -83,11 +83,12 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
8383
8484 if ( isBun && absolutePath . endsWith ( '.html' ) ) {
8585 const htmlBundle = await import ( absolutePath )
86+ const normalizedPath = pathName . replace ( / \\ / g, '/' )
8687
87- app . get ( pathName , htmlBundle . default )
88- if ( indexHTML && pathName . endsWith ( '/index.html' ) )
88+ app . get ( normalizedPath , htmlBundle . default )
89+ if ( indexHTML && normalizedPath . endsWith ( '/index.html' ) )
8990 app . get (
90- pathName . replace ( '/index.html' , '' ) ,
91+ normalizedPath . replace ( '/index.html' , '' ) ,
9192 htmlBundle . default
9293 )
9394
@@ -181,9 +182,9 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
181182
182183 return response . clone ( )
183184 }
184-
185+ const normalizedPath = pathName . replace ( / \\ / g , '/' )
185186 app . get (
186- pathName ,
187+ normalizedPath ,
187188 useETag
188189 ? ( handleCache as any )
189190 : new Response (
@@ -196,9 +197,9 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
196197 )
197198 )
198199
199- if ( indexHTML && pathName . endsWith ( '/index.html' ) )
200+ if ( indexHTML && normalizedPath . endsWith ( '/index.html' ) )
200201 app . get (
201- pathName . replace ( '/index.html' , '' ) ,
202+ normalizedPath . replace ( '/index.html' , '' ) ,
202203 useETag
203204 ? ( handleCache as any )
204205 : new Response (
@@ -227,13 +228,13 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
227228
228229 let relativePath = absolutePath . replace ( assetsDir , '' )
229230 const pathName = path . join ( prefix , relativePath )
230-
231+ const normalizedPath = pathName . replace ( / \\ / g , '/' )
231232 const htmlBundle = await import ( absolutePath )
232233
233- app . get ( pathName , htmlBundle . default )
234- if ( indexHTML && pathName . endsWith ( '/index.html' ) )
234+ app . get ( normalizedPath , htmlBundle . default )
235+ if ( indexHTML && normalizedPath . endsWith ( '/index.html' ) )
235236 app . get (
236- pathName . replace ( '/index.html' , '' ) ,
237+ normalizedPath . replace ( '/index.html' , '' ) ,
237238 htmlBundle . default
238239 )
239240 }
@@ -245,7 +246,7 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
245246 const pathName = path . join (
246247 assets ,
247248 decodeURI
248- ? ( fastDecodeURI ( params [ '*' ] ) ?? params [ '*' ] )
249+ ? fastDecodeURI ( params [ '*' ] ) ?? params [ '*' ]
249250 : params [ '*' ]
250251 )
251252
0 commit comments