fix(OfflineCompiler): Do not provide I18N values when they're not specified
fixes #11643
This commit is contained in:
parent
8395aab25d
commit
03aedbe54b
|
@ -107,18 +107,29 @@ export class OfflineCompiler {
|
||||||
|
|
||||||
private _compileModule(ngModuleType: StaticSymbol, targetStatements: o.Statement[]): string {
|
private _compileModule(ngModuleType: StaticSymbol, targetStatements: o.Statement[]): string {
|
||||||
const ngModule = this._metadataResolver.getNgModuleMetadata(ngModuleType);
|
const ngModule = this._metadataResolver.getNgModuleMetadata(ngModuleType);
|
||||||
const appCompileResult = this._ngModuleCompiler.compile(ngModule, [
|
const providers: CompileProviderMetadata[] = [];
|
||||||
new CompileProviderMetadata(
|
|
||||||
{token: resolveIdentifierToken(Identifiers.LOCALE_ID), useValue: this._localeId}),
|
if (this._localeId) {
|
||||||
new CompileProviderMetadata({
|
providers.push(new CompileProviderMetadata({
|
||||||
|
token: resolveIdentifierToken(Identifiers.LOCALE_ID),
|
||||||
|
useValue: this._localeId,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._translationFormat) {
|
||||||
|
providers.push(new CompileProviderMetadata({
|
||||||
token: resolveIdentifierToken(Identifiers.TRANSLATIONS_FORMAT),
|
token: resolveIdentifierToken(Identifiers.TRANSLATIONS_FORMAT),
|
||||||
useValue: this._translationFormat
|
useValue: this._translationFormat
|
||||||
})
|
}));
|
||||||
]);
|
}
|
||||||
|
|
||||||
|
const appCompileResult = this._ngModuleCompiler.compile(ngModule, providers);
|
||||||
|
|
||||||
appCompileResult.dependencies.forEach((dep) => {
|
appCompileResult.dependencies.forEach((dep) => {
|
||||||
dep.placeholder.name = _componentFactoryName(dep.comp);
|
dep.placeholder.name = _componentFactoryName(dep.comp);
|
||||||
dep.placeholder.moduleUrl = _ngfactoryModuleUrl(dep.comp.moduleUrl);
|
dep.placeholder.moduleUrl = _ngfactoryModuleUrl(dep.comp.moduleUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
targetStatements.push(...appCompileResult.statements);
|
targetStatements.push(...appCompileResult.statements);
|
||||||
return appCompileResult.ngModuleFactoryVar;
|
return appCompileResult.ngModuleFactoryVar;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue