Skip to content

Commit

Permalink
feat(@schematics/angular): default Ivy apps to AOT true
Browse files Browse the repository at this point in the history
Testing on AIO with Angular master as of 28/05/2019 I got these results:
JIT ~414ms (369, 378, 408, 323, 593)
AOT using VE ~1383ms (1365, 1185, 1767, 1135, 1467)
AOT using Ivy ~517ms (600, 391, 444, 756, 394)

This is largely due to angular/angular#29380 and angular/angular#30238.

The second PR above was not merged to master, and thus will not be in 8.0.0. This PR should be merged to match it.
  • Loading branch information
filipesilva committed May 28, 2019
1 parent 5df02a3 commit beee4f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
main: `${sourceRoot}/main.ts`,
polyfills: `${sourceRoot}/polyfills.ts`,
tsConfig: `${projectRoot}tsconfig.app.json`,
aot: !!options.enableIvy,
assets: [
`${sourceRoot}/favicon.ico`,
`${sourceRoot}/assets`,
Expand Down
18 changes: 18 additions & 0 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ describe('Application Schematic', () => {
]));
});

it('should set AOT option to false for VE projects', async () => {
const options = { ...defaultOptions };

const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const workspace = JSON.parse(tree.readContent('/angular.json'));
expect(workspace.projects.foo.architect.build.options.aot).toEqual(false);
});

it('should set AOT option to true for Ivy projects', async () => {
const options = { ...defaultOptions, enableIvy: true };

const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const workspace = JSON.parse(tree.readContent('/angular.json'));
expect(workspace.projects.foo.architect.build.options.aot).toEqual(true);
});

describe(`update package.json`, () => {
it(`should add build-angular to devDependencies`, async () => {
const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree)
Expand Down

0 comments on commit beee4f9

Please sign in to comment.