File tree 2 files changed +6
-3
lines changed
packages/angular/build/src/tools/vite
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export function createAngularComponentMiddleware(
18
18
return ;
19
19
}
20
20
21
- if ( ! req . url . startsWith ( ANGULAR_COMPONENT_PREFIX ) ) {
21
+ if ( ! req . url . includes ( ANGULAR_COMPONENT_PREFIX ) ) {
22
22
next ( ) ;
23
23
24
24
return ;
Original file line number Diff line number Diff line change @@ -46,8 +46,11 @@ export async function createAngularMemoryPlugin(
46
46
// Vite will resolve these these files example:
47
47
// `file:///@ng/component?c=src%2Fapp%2Fapp.component.ts%40AppComponent&t=1737017253850`
48
48
const sourcePath = fileURLToPath ( source ) ;
49
- const { root } = parse ( sourcePath ) ;
50
- const sourceWithoutRoot = normalizePath ( '/' + sourcePath . slice ( root . length ) ) ;
49
+ const sourceWithoutRoot = sourcePath . startsWith ( virtualProjectRoot )
50
+ ? normalizePath ( '/' + relative ( virtualProjectRoot , sourcePath ) )
51
+ : // TODO: remove once https://github.com/angular/angular/blob/4e6017a9f5cda389c5fbf4f2c1519ce1bba23e11/packages/compiler/src/render3/r3_hmr_compiler.ts#L57
52
+ // is changed from `/@ng` to `./@ng/`
53
+ normalizePath ( '/' + sourcePath . slice ( parse ( sourcePath ) . root . length ) ) ;
51
54
52
55
if ( sourceWithoutRoot . startsWith ( ANGULAR_PREFIX ) ) {
53
56
const [ , query ] = source . split ( '?' , 2 ) ;
You can’t perform that action at this time.
0 commit comments