Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 8840f91

Browse files
committed
refactor: use es2015 module target when bundling for Angular
1 parent a2608ce commit 8840f91

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

projectFilesManager.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ function copyTemplate(templateName, destinationPath) {
5858

5959
function getProjectTemplates(projectDir) {
6060
const templates = {}
61-
const CONFIG_NAME = "webpack.config.js";
6261

62+
const WEBPACK_CONFIG_NAME = "webpack.config.js";
6363
if (isAngular({projectDir})) {
64-
templates["webpack.angular.js"] = CONFIG_NAME;
64+
templates["webpack.angular.js"] = WEBPACK_CONFIG_NAME;
65+
templates["tsconfig.esm.json"] = "tsconfig.esm.json";
6566
} else if (isTypeScript({projectDir})) {
66-
templates["webpack.typescript.js"] = CONFIG_NAME;
67+
templates["webpack.typescript.js"] = WEBPACK_CONFIG_NAME;
6768
} else {
68-
templates["webpack.javascript.js"] = CONFIG_NAME;
69+
templates["webpack.javascript.js"] = WEBPACK_CONFIG_NAME;
6970
}
7071

7172
return getFullTemplatesPath(projectDir, templates);

templates/tsconfig.esm.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"module": "es2015",
5+
"moduleResolution": "node"
6+
}
7+
}

templates/webpack.angular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = env => {
4242
uglify, // --env.uglify
4343
report, // --env.report
4444
} = env;
45-
const ngToolsWebpackOptions = { tsConfigPath: join(__dirname, "tsconfig.json") };
45+
const ngToolsWebpackOptions = { tsConfigPath: join(__dirname, "tsconfig.esm.json") };
4646

4747
const appFullPath = resolve(projectRoot, appPath);
4848
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);

0 commit comments

Comments
 (0)