fix(ivy): properly tree-shake away StaticInjector (#30219)

Ivy uses R3Injector, but we are currently pulling in both the StaticInjector
(View Engine injector) and the R3Injector when running with Ivy. This commit
adds an ivy switch so calling Injector.create() pulls in the correct
implementation of the injector depending on whether you are using VE or Ivy.
This saves us about 3KB in the bundle.

PR Close #30219
This commit is contained in:
Kara Erickson
2019-04-30 20:24:00 -07:00
parent b1506a3271
commit 7d6f4885b2
15 changed files with 167 additions and 147 deletions

View File

@ -232,10 +232,7 @@ function bootstrap(
]).then(null, (e: Error) => {
let errorMsg: string;
if (ivyEnabled) {
errorMsg = `R3InjectorError(TestModule)[IDontExist]: \n` +
' StaticInjectorError(TestModule)[IDontExist]: \n' +
' StaticInjectorError(Platform: core)[IDontExist]: \n' +
' NullInjectorError: No provider for IDontExist!';
errorMsg = `R3InjectorError(TestModule)[IDontExist -> IDontExist -> IDontExist]: \n`;
} else {
errorMsg = `StaticInjectorError(TestModule)[CustomCmp -> IDontExist]: \n` +
' StaticInjectorError(Platform: core)[CustomCmp -> IDontExist]: \n' +