Skip to content

Commit 828d42c

Browse files
committed
adding resolve alias @prefix and app to webpack config and adding paths @prefix and app to tsconfig.json. trying to fix #1465
1 parent f6fa1a5 commit 828d42c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
"target": "es5",
1313
"typeRoots": [
1414
"../node_modules/@types"
15-
]
15+
],
16+
"baseUrl": ".",
17+
"paths": {
18+
"@<%= prefix %>/*": ["app/*"],
19+
"app/*": ["app/*"]
20+
}
1621
}
1722
}

packages/angular-cli/models/webpack-build-common.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ export function getWebpackCommonConfig(
3333
if (appConfig.styles.length > 0) { entry['styles'] = styles; }
3434
if (appConfig.scripts.length > 0) { entry['scripts'] = scripts; }
3535

36+
let aliasConfig: any = {
37+
'app': path.join(appRoot, 'app')
38+
};
39+
aliasConfig['@' + appConfig.prefix] = path.join(appRoot, 'app');
40+
3641
return {
3742
devtool: 'source-map',
3843
resolve: {
3944
extensions: ['', '.ts', '.js'],
40-
root: appRoot
45+
root: appRoot,
46+
alias: aliasConfig
4147
},
4248
context: path.resolve(__dirname, './'),
4349
entry: entry,

0 commit comments

Comments
 (0)