Skip to content

Commit

Permalink
fix(@angular/cli): remove forced commonjs
Browse files Browse the repository at this point in the history
Followup to #8128
Fix #9058
  • Loading branch information
filipesilva committed Feb 28, 2018
1 parent 36d2393 commit d5192da
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 28 deletions.
5 changes: 0 additions & 5 deletions packages/@angular/cli/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ const BuildCommand = Command.extend({
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
Version.assertTypescriptVersion(this.project.root);

// Force commonjs module format for TS on dev watch builds.
if (commandOptions.target === 'development' && commandOptions.watch === true) {
commandOptions.forceTsCommonjs = true;
}

// Add trailing slash if missing to prevent https://github.com/angular/angular-cli/issues/7295
if (commandOptions.deployUrl && commandOptions.deployUrl.substr(-1) !== '/') {
commandOptions.deployUrl += '/';
Expand Down
5 changes: 0 additions & 5 deletions packages/@angular/cli/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ const ServeCommand = Command.extend({
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
Version.assertTypescriptVersion(this.project.root);

// Force commonjs module format for TS on dev builds.
if (commandOptions.target === 'development') {
commandOptions.forceTsCommonjs = true;
}

// Default evalSourcemaps to true for serve. This makes rebuilds faster.
commandOptions.evalSourcemaps = true;

Expand Down
7 changes: 0 additions & 7 deletions packages/@angular/cli/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface TestOptions {
environment?: string;
app?: string;
preserveSymlinks?: boolean;
forceTsCommonjs?: boolean;
}


Expand Down Expand Up @@ -138,12 +137,6 @@ const TestCommand = Command.extend({
commandOptions.singleRun = true;
}

// Don't force commonjs for code coverage builds, some setups need es2015 for it.
// https://github.com/angular/angular-cli/issues/5526
if (!commandOptions.codeCoverage) {
commandOptions.forceTsCommonjs = true;
}

return testTask.run(commandOptions);
}
});
Expand Down
1 change: 0 additions & 1 deletion packages/@angular/cli/models/build-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface BuildOptions {
buildOptimizer?: boolean;
namedChunks?: boolean;
subresourceIntegrity?: boolean;
forceTsCommonjs?: boolean;
serviceWorker?: boolean;
skipAppShell?: boolean;
}
3 changes: 0 additions & 3 deletions packages/@angular/cli/models/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;

// TODO: Remove this functionality completely as it is no longer needed with Webpack 4
buildOptions.forceTsCommonjs = false;

this.wco = { projectRoot, buildOptions, appConfig, tsConfig, supportES2015 };
}

Expand Down
6 changes: 0 additions & 6 deletions packages/@angular/cli/models/webpack-configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any, useMain = tru
options.compilerOptions.preserveSymlinks = true;
}

// Forcing commonjs seems to drastically improve rebuild speeds on webpack.
// Dev builds on watch mode will set this option to true.
if (wco.buildOptions.forceTsCommonjs) {
options.compilerOptions.module = 'commonjs';
}

// Read the environment, and set it in the compiler host.
let hostReplacementPaths: any = {};
// process environment file replacement
Expand Down
1 change: 0 additions & 1 deletion packages/@angular/cli/tasks/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default Task.extend({
poll: options.poll,
environment: options.environment,
preserveSymlinks: options.preserveSymlinks,
forceTsCommonjs: options.forceTsCommonjs,
app: options.app
};

Expand Down

0 comments on commit d5192da

Please sign in to comment.