Skip to content

Commit 7972a86

Browse files
committed
feat(config): use of webpack externals
1 parent 30cc482 commit 7972a86

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

packages/angular-cli/lib/config/schema.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export interface CliConfig {
2727
* Global scripts to be included in the build.
2828
*/
2929
scripts?: string[];
30+
/**
31+
* Global scripts to be used internally.
32+
* See https://webpack.github.io/docs/library-and-externals.html
33+
*/
34+
externals: {[name: string]: string};
3035
/**
3136
* Name and corresponding file for environment config.
3237
*/

packages/angular-cli/lib/config/schema.json

+5
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
},
7575
"additionalProperties": false
7676
},
77+
"externals": {
78+
"description": "Global scripts to be used internally.",
79+
"type": "object",
80+
"additionalProperties": true
81+
},
7782
"environments": {
7883
"description": "Name and corresponding file for environment config.",
7984
"type": "object",

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

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export function getWebpackCommonConfig(
2222
const scripts = appConfig.scripts
2323
? appConfig.scripts.map((script: string) => path.resolve(appRoot, script))
2424
: [];
25+
const externals = appConfig.externals || {};
2526

2627
let entry: { [key: string]: string[] } = {
2728
main: [appMain]
@@ -43,6 +44,7 @@ export function getWebpackCommonConfig(
4344
path: path.resolve(projectRoot, appConfig.outDir),
4445
filename: '[name].bundle.js'
4546
},
47+
externals: externals,
4648
module: {
4749
rules: [
4850
{

0 commit comments

Comments
 (0)