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
This commit is contained in:
parent
0d6fdec4bd
commit
a5ea55a636
|
@ -54,11 +54,11 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
||||||
throw new Error(error.join('\n'));
|
throw new Error(error.join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const sourceMapUrl = `ng://${renderStringify(type)}/template.html`;
|
const templateUrl = metadata.templateUrl || `ng:///${renderStringify(type)}/template.html`;
|
||||||
const meta: R3ComponentMetadataFacade = {
|
const meta: R3ComponentMetadataFacade = {
|
||||||
...directiveMetadata(type, metadata),
|
...directiveMetadata(type, metadata),
|
||||||
typeSourceSpan:
|
typeSourceSpan:
|
||||||
compiler.createParseSourceSpan('Component', renderStringify(type), sourceMapUrl),
|
compiler.createParseSourceSpan('Component', renderStringify(type), templateUrl),
|
||||||
template: metadata.template || '',
|
template: metadata.template || '',
|
||||||
preserveWhitespaces: metadata.preserveWhitespaces || false,
|
preserveWhitespaces: metadata.preserveWhitespaces || false,
|
||||||
styles: metadata.styles || EMPTY_ARRAY,
|
styles: metadata.styles || EMPTY_ARRAY,
|
||||||
|
@ -71,7 +71,7 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
||||||
interpolation: metadata.interpolation,
|
interpolation: metadata.interpolation,
|
||||||
viewProviders: metadata.viewProviders || null,
|
viewProviders: metadata.viewProviders || null,
|
||||||
};
|
};
|
||||||
ngComponentDef = compiler.compileComponent(angularCoreEnv, sourceMapUrl, meta);
|
ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
|
||||||
|
|
||||||
// When NgModule decorator executed, we enqueued the module definition such that
|
// When NgModule decorator executed, we enqueued the module definition such that
|
||||||
// it would only dequeue and add itself as module scope to all of its declarations,
|
// it would only dequeue and add itself as module scope to all of its declarations,
|
||||||
|
|
Loading…
Reference in New Issue