Skip to content

Commit ba39f73

Browse files
committed
feat(config): use of webpack externals
1 parent c935039 commit ba39f73

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
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

+6-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@
6969
},
7070
"additionalProperties": false
7171
},
72+
"externals": {
73+
"description": "Global scripts to be used internally.",
74+
"type": "object",
75+
"additionalProperties": true
76+
},
7277
"environments": {
7378
"description": "Name and corresponding file for environment config.",
7479
"type": "object",
@@ -141,4 +146,4 @@
141146
}
142147
},
143148
"additionalProperties": false
144-
}
149+
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export function getWebpackCommonConfig(
2323
const scripts = appConfig.scripts
2424
? appConfig.scripts.map((script: string) => path.resolve(appRoot, script))
2525
: [];
26+
const externals = appConfig.externals || [];
27+
2628
const lazyModules = findLazyModules(appRoot);
2729

2830
let entry: { [key: string]: string[] } = {
@@ -45,6 +47,7 @@ export function getWebpackCommonConfig(
4547
path: path.resolve(projectRoot, appConfig.outDir),
4648
filename: '[name].bundle.js'
4749
},
50+
externals: externals,
4851
module: {
4952
preLoaders: [
5053
{

0 commit comments

Comments
 (0)