diff --git a/packages/@angular/cli/lib/config/schema.json b/packages/@angular/cli/lib/config/schema.json index 2b7515cb56a7..70d27910c5f8 100644 --- a/packages/@angular/cli/lib/config/schema.json +++ b/packages/@angular/cli/lib/config/schema.json @@ -46,8 +46,7 @@ "type": "array", "description": "List of application assets.", "items": { - "oneOf": [ - { + "oneOf": [{ "type": "string" }, { @@ -118,8 +117,7 @@ "description": "Global styles to be included in the build.", "type": "array", "items": { - "oneOf": [ - { + "oneOf": [{ "type": "string" }, { @@ -150,12 +148,16 @@ }, "additionalProperties": false }, + "uglifyOptions": { + "description": "Options to pass to the Uglify plugin", + "type": "object", + "additionalProperties": true + }, "scripts": { "description": "Global scripts to be included in the build.", "type": "array", "items": { - "oneOf": [ - { + "oneOf": [{ "type": "string" }, { @@ -174,7 +176,7 @@ }, "additionalProperties": false }, - "environmentSource":{ + "environmentSource": { "description": "Source file for environment config.", "type": "string" }, @@ -213,8 +215,7 @@ "properties": { "files": { "description": "File glob(s) to lint.", - "oneOf": [ - { + "oneOf": [{ "type": "string" }, { @@ -237,8 +238,7 @@ }, "exclude": { "description": "File glob(s) to ignore.", - "oneOf": [ - { + "oneOf": [{ "type": "string" }, { @@ -475,7 +475,7 @@ }, "packageManager": { "description": "Specify which package manager tool to use.", - "enum": [ "npm", "cnpm", "yarn", "default" ], + "enum": ["npm", "cnpm", "yarn", "default"], "default": "default", "type": "string" }, diff --git a/packages/@angular/cli/models/webpack-configs/production.ts b/packages/@angular/cli/models/webpack-configs/production.ts index b54e6fa9ee36..b4bc80522d2a 100644 --- a/packages/@angular/cli/models/webpack-configs/production.ts +++ b/packages/@angular/cli/models/webpack-configs/production.ts @@ -12,7 +12,12 @@ export const getProdConfig = function (wco: WebpackConfigOptions) { const { projectRoot, buildOptions, appConfig } = wco; let extraPlugins: any[] = []; - let entryPoints: {[key: string]: string[]} = {}; + let entryPoints: { [key: string]: string[] } = {}; + let appUglifyOptions = appConfig.uglifyOptions || {}; + let baseUglifyOptions = { + mangle: { screw_ie8: true }, + compress: { screw_ie8: true, warnings: buildOptions.verbose } + }; if (appConfig.serviceWorker) { const nodeModules = path.resolve(projectRoot, 'node_modules'); @@ -65,7 +70,7 @@ export const getProdConfig = function (wco: WebpackConfigOptions) { // Load the Webpack plugin for manifest generation and install it. const AngularServiceWorkerPlugin = require('@angular/service-worker/build/webpack') - .AngularServiceWorkerPlugin; + .AngularServiceWorkerPlugin; extraPlugins.push(new AngularServiceWorkerPlugin({ baseHref: buildOptions.baseHref || '/', })); @@ -87,8 +92,8 @@ export const getProdConfig = function (wco: WebpackConfigOptions) { }), new (webpack).HashedModuleIdsPlugin(), new webpack.optimize.UglifyJsPlugin({ - mangle: { screw_ie8: true }, - compress: { screw_ie8: true, warnings: buildOptions.verbose }, + mangle: Object.assign(baseUglifyOptions.mangle, appUglifyOptions.mangle), + compress: Object.assign(baseUglifyOptions.compress, appUglifyOptions.compress), sourceMap: buildOptions.sourcemap }) ].concat(extraPlugins)