Skip to content

Commit a5ea55a

Browse files
petebacondarwinmhevery
authored andcommitted
fix(core): use the correct template URL in render3 JIT compilation (#28055)
Previously JIT compiled components did not use the correct URL if the template was resolved from a `templateUrl`. PR Close #28055
1 parent 0d6fdec commit a5ea55a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/render3/jit/directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
5454
throw new Error(error.join('\n'));
5555
}
5656

57-
const sourceMapUrl = `ng://${renderStringify(type)}/template.html`;
57+
const templateUrl = metadata.templateUrl || `ng:///${renderStringify(type)}/template.html`;
5858
const meta: R3ComponentMetadataFacade = {
5959
...directiveMetadata(type, metadata),
6060
typeSourceSpan:
61-
compiler.createParseSourceSpan('Component', renderStringify(type), sourceMapUrl),
61+
compiler.createParseSourceSpan('Component', renderStringify(type), templateUrl),
6262
template: metadata.template || '',
6363
preserveWhitespaces: metadata.preserveWhitespaces || false,
6464
styles: metadata.styles || EMPTY_ARRAY,
@@ -71,7 +71,7 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
7171
interpolation: metadata.interpolation,
7272
viewProviders: metadata.viewProviders || null,
7373
};
74-
ngComponentDef = compiler.compileComponent(angularCoreEnv, sourceMapUrl, meta);
74+
ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
7575

7676
// When NgModule decorator executed, we enqueued the module definition such that
7777
// it would only dequeue and add itself as module scope to all of its declarations,

0 commit comments

Comments
 (0)