fix(ivy): use globally unique names for i18n constants (#25689)
Closure compiler requires that the i18n message constants of the form const MSG_XYZ = goog.getMessage('...'); have names that are unique across an entire compilation, even if the variables themselves are local to a given module. This means that in practice these names must be unique in a codebase. The best way to guarantee this requirement is met is to encode the relative file name of the file into which the constant is being written into the constant name itself. This commit implements that solution. PR Close #25689
This commit is contained in:

committed by
Misko Hevery

parent
bd0eb0d1d4
commit
cc29b9cf93
@ -54,10 +54,11 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
||||
const constantPool = new ConstantPool();
|
||||
|
||||
// Parse the template and check for errors.
|
||||
const template =
|
||||
parseTemplate(metadata.template !, `ng://${stringify(type)}/template.html`, {
|
||||
const template = parseTemplate(
|
||||
metadata.template !, `ng://${stringify(type)}/template.html`, {
|
||||
preserveWhitespaces: metadata.preserveWhitespaces || false,
|
||||
});
|
||||
},
|
||||
'');
|
||||
if (template.errors !== undefined) {
|
||||
const errors = template.errors.map(err => err.toString()).join(', ');
|
||||
throw new Error(
|
||||
|
Reference in New Issue
Block a user