@@ -123,11 +123,6 @@ export function createAngularMemoryPlugin(options: AngularMemoryPluginOptions):
123
123
// The base of the URL is unused but required to parse the URL.
124
124
const pathname = pathnameWithoutBasePath ( req . url , server . config . base ) ;
125
125
const extension = extname ( pathname ) ;
126
- if ( ! extension ) {
127
- next ( ) ;
128
-
129
- return ;
130
- }
131
126
132
127
// Rewrite all build assets to a vite raw fs URL
133
128
const assetSourcePath = assets . get ( pathname ) ;
@@ -323,24 +318,16 @@ function angularHtmlFallbackMiddleware(
323
318
// Similar to how it is handled in vite
324
319
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/htmlFallback.ts#L15C19-L15C45
325
320
if (
326
- // Only accept GET or HEAD
327
- ( req . method !== 'GET' && req . method !== 'HEAD' ) ||
328
- // Has file extensions
329
- ( req . url && lookupMimeTypeFromRequest ( req . url ) ) ||
330
- // Require Accept: text/html or */*
331
- ! (
332
- req . headers . accept === undefined || // equivalent to `Accept: */*`
333
- req . headers . accept === '' || // equivalent to `Accept: */*`
321
+ ( req . method === 'GET' || req . method === 'HEAD' ) &&
322
+ ( ! req . url || ! lookupMimeTypeFromRequest ( req . url ) ) &&
323
+ ( ! req . headers . accept ||
334
324
req . headers . accept . includes ( 'text/html' ) ||
335
- req . headers . accept . includes ( '* /*' )
336
- )
325
+ req . headers . accept . includes ( 'text /*' ) ||
326
+ req . headers . accept . includes ( '*/*' ) )
337
327
) {
338
- next ( ) ;
339
-
340
- return ;
328
+ req . url = '/index.html' ;
341
329
}
342
330
343
- req . url = '/index.html' ;
344
331
next ( ) ;
345
332
}
346
333
0 commit comments