From 7972a860adb21ce96f4f7cb815808c7e52f80d91 Mon Sep 17 00:00:00 2001 From: choclate Date: Fri, 16 Sep 2016 15:24:50 +0200 Subject: [PATCH 1/2] feat(config): use of webpack externals --- packages/angular-cli/lib/config/schema.d.ts | 5 +++++ packages/angular-cli/lib/config/schema.json | 5 +++++ packages/angular-cli/models/webpack-build-common.ts | 2 ++ 3 files changed, 12 insertions(+) diff --git a/packages/angular-cli/lib/config/schema.d.ts b/packages/angular-cli/lib/config/schema.d.ts index c1fd6850d710..1c05de89e75e 100644 --- a/packages/angular-cli/lib/config/schema.d.ts +++ b/packages/angular-cli/lib/config/schema.d.ts @@ -27,6 +27,11 @@ export interface CliConfig { * Global scripts to be included in the build. */ scripts?: string[]; + /** + * Global scripts to be used internally. + * See https://webpack.github.io/docs/library-and-externals.html + */ + externals: {[name: string]: string}; /** * Name and corresponding file for environment config. */ diff --git a/packages/angular-cli/lib/config/schema.json b/packages/angular-cli/lib/config/schema.json index b02dbb6c1026..75c2a1ea899b 100644 --- a/packages/angular-cli/lib/config/schema.json +++ b/packages/angular-cli/lib/config/schema.json @@ -74,6 +74,11 @@ }, "additionalProperties": false }, + "externals": { + "description": "Global scripts to be used internally.", + "type": "object", + "additionalProperties": true + }, "environments": { "description": "Name and corresponding file for environment config.", "type": "object", diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index c2c90f91f1e5..71abf3bdcfc0 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -22,6 +22,7 @@ export function getWebpackCommonConfig( const scripts = appConfig.scripts ? appConfig.scripts.map((script: string) => path.resolve(appRoot, script)) : []; + const externals = appConfig.externals || {}; let entry: { [key: string]: string[] } = { main: [appMain] @@ -43,6 +44,7 @@ export function getWebpackCommonConfig( path: path.resolve(projectRoot, appConfig.outDir), filename: '[name].bundle.js' }, + externals: externals, module: { rules: [ { From a5a9d6c4aa6d42d4b47cc5f9e822c55ffba2bc26 Mon Sep 17 00:00:00 2001 From: choclate Date: Sun, 30 Oct 2016 15:26:51 +0100 Subject: [PATCH 2/2] fix(dependency): quick fix of #2943 --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index a25c71729a40..a3cffd0ea50f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "homepage": "https://github.com/angular/angular-cli", "dependencies": { "@angular-cli/ast-tools": "^1.0.0", + "@angular-cli/base-href-webpack": "^1.0.6", "@angular/common": "~2.1.0", "@angular/compiler": "~2.1.0", "@angular/compiler-cli": "~2.1.0", @@ -52,6 +53,7 @@ "@angular/platform-browser": "~2.1.0", "@angular/platform-server": "~2.1.0", "@angular/tsc-wrapped": "^0.3.0", + "@ngtools/webpack": "^1.1.4", "angular2-template-loader": "^0.5.0", "awesome-typescript-loader": "^2.2.3", "chalk": "^1.1.3",