refactor(localize): avoid computing source-maps in extraction unnecessarily (#40891)
Previously we were calling `updateSourceLocations()` as part of `extractMessages()` for every file that was passed in, regardless of whether any `$localize` tagged strings were to be found in the file. This was very wasteful because it is non-trivial to compute the flattened source-map for files if it is not needed. PR Close #40891
This commit is contained in:
parent
bafab6de79
commit
f57cd19e0c
|
@ -58,10 +58,10 @@ export class MessageExtractor {
|
|||
code: false,
|
||||
ast: false
|
||||
});
|
||||
}
|
||||
if (this.useSourceMaps) {
|
||||
if (this.useSourceMaps && messages.length > 0) {
|
||||
this.updateSourceLocations(filename, sourceCode, messages);
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue