Skip to content

Commit 9751532

Browse files
clydinhansl
authored andcommittedJan 23, 2018
fix(@angular/cli): only force CommonJS if module kind is ES2015
1 parent ca8e834 commit 9751532

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

Diff for: ‎packages/@angular/cli/models/webpack-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export class NgCliWebpackConfig<T extends BuildOptions = BuildOptions> {
4848
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
4949
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;
5050

51+
// Only force if the default module kind is used (ES2015)
52+
// Allows user to adjust module kind (to esNext for example)
53+
buildOptions.forceTsCommonjs = buildOptions.forceTsCommonjs
54+
&& tsConfig.options.module === projectTs.ModuleKind.ES2015;
55+
5156
this.wco = { projectRoot, buildOptions, appConfig, tsConfig, supportES2015 };
5257
}
5358

0 commit comments

Comments
 (0)