Skip to content

Commit 67248be

Browse files
filipesilvaBrocco
authored andcommitted
feat(@angular/cli): always use new compiler with Angular 5
1 parent eec4fd3 commit 67248be

File tree

6 files changed

+7
-22
lines changed

6 files changed

+7
-22
lines changed

packages/@angular/cli/commands/build.ts

-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { CliConfig } from '../models/config';
22
import { BuildOptions } from '../models/build-options';
33
import { Version } from '../upgrade/version';
44
import { oneLine } from 'common-tags';
5-
import { AngularCompilerPlugin } from '@ngtools/webpack';
65

76
const Command = require('../ember-cli/lib/models/command');
87

@@ -178,13 +177,6 @@ export const baseBuildCommandOptions: any = [
178177
description: 'Use file name for lazy loaded chunks.',
179178
default: buildConfigDefaults['namedChunks']
180179
},
181-
{
182-
name: 'experimental-angular-compiler',
183-
type: Boolean,
184-
// aliases: ['eac'], // We should not have shorthand aliases for experimental flags.
185-
description: '(Experimental) Use new Angular Compiler (Angular version 5 and greater only).',
186-
default: AngularCompilerPlugin.isSupported()
187-
},
188180
{
189181
name: 'subresource-integrity',
190182
type: Boolean,

packages/@angular/cli/models/build-options.ts

-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ export interface BuildOptions {
2727
showCircularDependencies?: boolean;
2828
buildOptimizer?: boolean;
2929
namedChunks?: boolean;
30-
experimentalAngularCompiler?: boolean;
3130
subresourceIntegrity?: boolean;
3231
}

packages/@angular/cli/models/webpack-config.ts

-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
getAotConfig
1313
} from './webpack-configs';
1414
import * as path from 'path';
15-
import { AngularCompilerPlugin } from '@ngtools/webpack';
1615

1716
export interface WebpackConfigOptions<T extends BuildOptions = BuildOptions> {
1817
projectRoot: string;
@@ -79,10 +78,6 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
7978
&& !(buildOptions.aot || buildOptions.target === 'production')) {
8079
throw new Error('The `--build-optimizer` option cannot be used without `--aot`.');
8180
}
82-
83-
if (buildOptions.experimentalAngularCompiler && !AngularCompilerPlugin.isSupported()) {
84-
throw new Error('You need Angular 5 and up to use --experimental-angular-compiler.');
85-
}
8681
}
8782

8883
// Fill in defaults for build targets

packages/@angular/cli/models/webpack-configs/typescript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any) {
7373
};
7474
}
7575

76-
if (wco.buildOptions.experimentalAngularCompiler) {
76+
if (AngularCompilerPlugin.isSupported()) {
7777
const pluginOptions: AngularCompilerPluginOptions = Object.assign({}, {
7878
mainPath: path.join(projectRoot, appConfig.root, appConfig.main),
7979
i18nInFile: buildOptions.i18nFile,

packages/@angular/cli/models/webpack-xi18n-config.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface XI18WebpackOptions {
1414
verbose?: boolean;
1515
progress?: boolean;
1616
app?: string;
17-
experimentalAngularCompiler?: boolean;
17+
aot?: boolean;
1818
}
1919
export class XI18nWebpackConfig extends NgCliWebpackConfig {
2020

@@ -26,18 +26,17 @@ export class XI18nWebpackConfig extends NgCliWebpackConfig {
2626
target: 'development',
2727
verbose: extractOptions.verbose,
2828
progress: extractOptions.progress,
29-
experimentalAngularCompiler: extractOptions.experimentalAngularCompiler,
3029
locale: extractOptions.locale,
3130
i18nOutFormat: extractOptions.i18nFormat,
3231
i18nOutFile: extractOptions.outFile,
33-
aot: extractOptions.experimentalAngularCompiler
32+
aot: extractOptions.aot
3433
}, appConfig);
3534
super.buildConfig();
3635
}
3736

3837
public buildConfig() {
3938
// The extra extraction config is only needed in Angular 2/4.
40-
if (!this.extractOptions.experimentalAngularCompiler) {
39+
if (!this.extractOptions.aot) {
4140
const configPath = CliConfig.configFilePath();
4241
const projectRoot = path.dirname(configPath);
4342

packages/@angular/cli/tasks/extract-i18n.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const MemoryFS = require('memory-fs');
1111
export const Extracti18nTask = Task.extend({
1212
run: function (runTaskOptions: any) {
1313
const appConfig = getAppFromConfig(runTaskOptions.app);
14-
const experimentalAngularCompiler = AngularCompilerPlugin.isSupported();
14+
const useExperimentalAngularCompiler = AngularCompilerPlugin.isSupported();
1515

1616
// We need to determine the outFile name so that AngularCompiler can retrieve it.
1717
let outFile = runTaskOptions.outFile || getI18nOutfile(runTaskOptions.i18nFormat);
18-
if (experimentalAngularCompiler && runTaskOptions.outputPath) {
18+
if (useExperimentalAngularCompiler && runTaskOptions.outputPath) {
1919
// AngularCompilerPlugin doesn't support genDir so we have to adjust outFile instead.
2020
outFile = join(runTaskOptions.outputPath, outFile);
2121
}
@@ -29,7 +29,7 @@ export const Extracti18nTask = Task.extend({
2929
verbose: runTaskOptions.verbose,
3030
progress: runTaskOptions.progress,
3131
app: runTaskOptions.app,
32-
experimentalAngularCompiler,
32+
aot: useExperimentalAngularCompiler,
3333
}, appConfig).buildConfig();
3434

3535
const webpackCompiler = webpack(config);

0 commit comments

Comments
 (0)