Skip to content

Commit d5192da

Browse files
committed
fix(@angular/cli): remove forced commonjs
Followup to #8128 Fix #9058
1 parent 36d2393 commit d5192da

File tree

7 files changed

+0
-28
lines changed

7 files changed

+0
-28
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,6 @@ const BuildCommand = Command.extend({
234234
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
235235
Version.assertTypescriptVersion(this.project.root);
236236

237-
// Force commonjs module format for TS on dev watch builds.
238-
if (commandOptions.target === 'development' && commandOptions.watch === true) {
239-
commandOptions.forceTsCommonjs = true;
240-
}
241-
242237
// Add trailing slash if missing to prevent https://github.com/angular/angular-cli/issues/7295
243238
if (commandOptions.deployUrl && commandOptions.deployUrl.substr(-1) !== '/') {
244239
commandOptions.deployUrl += '/';

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ const ServeCommand = Command.extend({
130130
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
131131
Version.assertTypescriptVersion(this.project.root);
132132

133-
// Force commonjs module format for TS on dev builds.
134-
if (commandOptions.target === 'development') {
135-
commandOptions.forceTsCommonjs = true;
136-
}
137-
138133
// Default evalSourcemaps to true for serve. This makes rebuilds faster.
139134
commandOptions.evalSourcemaps = true;
140135

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export interface TestOptions {
2424
environment?: string;
2525
app?: string;
2626
preserveSymlinks?: boolean;
27-
forceTsCommonjs?: boolean;
2827
}
2928

3029

@@ -138,12 +137,6 @@ const TestCommand = Command.extend({
138137
commandOptions.singleRun = true;
139138
}
140139

141-
// Don't force commonjs for code coverage builds, some setups need es2015 for it.
142-
// https://github.com/angular/angular-cli/issues/5526
143-
if (!commandOptions.codeCoverage) {
144-
commandOptions.forceTsCommonjs = true;
145-
}
146-
147140
return testTask.run(commandOptions);
148141
}
149142
});

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface BuildOptions {
3030
buildOptimizer?: boolean;
3131
namedChunks?: boolean;
3232
subresourceIntegrity?: boolean;
33-
forceTsCommonjs?: boolean;
3433
serviceWorker?: boolean;
3534
skipAppShell?: boolean;
3635
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
4747
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
4848
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;
4949

50-
// TODO: Remove this functionality completely as it is no longer needed with Webpack 4
51-
buildOptions.forceTsCommonjs = false;
52-
5350
this.wco = { projectRoot, buildOptions, appConfig, tsConfig, supportES2015 };
5451
}
5552

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any, useMain = tru
2424
options.compilerOptions.preserveSymlinks = true;
2525
}
2626

27-
// Forcing commonjs seems to drastically improve rebuild speeds on webpack.
28-
// Dev builds on watch mode will set this option to true.
29-
if (wco.buildOptions.forceTsCommonjs) {
30-
options.compilerOptions.module = 'commonjs';
31-
}
32-
3327
// Read the environment, and set it in the compiler host.
3428
let hostReplacementPaths: any = {};
3529
// process environment file replacement

packages/@angular/cli/tasks/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default Task.extend({
4444
poll: options.poll,
4545
environment: options.environment,
4646
preserveSymlinks: options.preserveSymlinks,
47-
forceTsCommonjs: options.forceTsCommonjs,
4847
app: options.app
4948
};
5049

0 commit comments

Comments
 (0)