├── .gitignore ├── .huskyrc ├── index.ts ├── .vscode └── settings.json ├── tslint.json ├── .prettierrc ├── tsconfig.prod.json ├── .npmignore ├── .lintstagedrc ├── tsconfig.json ├── src ├── browser │ ├── index.ts │ └── schema.json ├── dev-server │ ├── index.ts │ └── schema.json └── common.ts ├── LICENSE ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | /dist 4 | *.tgz 5 | /coverage -------------------------------------------------------------------------------- /.huskyrc: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "npx lint-staged" 4 | } 5 | } -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from './src/browser' 2 | export * from './src/dev-server' 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended", "tslint-config-standard", "tslint-config-prettier"] 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "semi": false, 4 | "singleQuote": true, 5 | "arrowParens": "always", 6 | "printWidth": 120 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": ["./index.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | /src 4 | /docs 5 | /tsconfig* 6 | /tslint* 7 | /index.ts 8 | .prettierignore 9 | .vscode 10 | *.tgz 11 | *.md 12 | /coverage -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js,ts,tsx,json,css,less,yml}": [ 3 | "npx prettier --write", 4 | "git add" 5 | ], 6 | "*.md": [ 7 | "npx doctoc", 8 | "npx prettier --write", 9 | "git add" 10 | ] 11 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "alwaysStrict": true, 4 | "strict": true, 5 | "noUnusedLocals": true, 6 | "noFallthroughCasesInSwitch": true, 7 | "target": "es2015", 8 | "baseUrl": "./", 9 | "moduleResolution": "node", 10 | "declaration": true, 11 | "removeComments": true, 12 | "module": "commonjs", 13 | "experimentalDecorators": true, 14 | "emitDecoratorMetadata": true 15 | }, 16 | "include": ["./**/*.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /src/browser/index.ts: -------------------------------------------------------------------------------- 1 | import { createBuilder } from '@angular-devkit/architect' 2 | import { executeBrowserBuilder } from '@angular-devkit/build-angular' 3 | import { Schema as BrowserBuilderSchema } from '@angular-devkit/build-angular/src/browser/schema' 4 | import { json } from '@angular-devkit/core' 5 | 6 | import { decorateBuilder } from '../common' 7 | 8 | export * from '@angular-devkit/build-angular/src/browser' 9 | export default createBuilder(decorateBuilder(executeBrowserBuilder)) 10 | -------------------------------------------------------------------------------- /src/dev-server/index.ts: -------------------------------------------------------------------------------- 1 | import { createBuilder } from '@angular-devkit/architect' 2 | import { executeDevServerBuilder } from '@angular-devkit/build-angular' 3 | import { Schema as DevServerBuilderSchema } from '@angular-devkit/build-angular/src/dev-server/schema' 4 | import { json } from '@angular-devkit/core' 5 | 6 | import { decorateBuilder } from '../common' 7 | 8 | export * from '@angular-devkit/build-angular/src/dev-server' 9 | export default createBuilder(decorateBuilder(executeDevServerBuilder)) 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Andrey Goncharov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/common.ts: -------------------------------------------------------------------------------- 1 | import { BuilderContext } from '@angular-devkit/architect' 2 | import { ExecutionTransformer } from '@angular-devkit/build-angular' 3 | import TerserPlugin = require('terser-webpack-plugin') 4 | import { Configuration } from 'webpack' 5 | 6 | type BuilderCustom = ( 7 | options: Options, 8 | context: BuilderContext, 9 | transforms?: { 10 | webpackConfiguration?: ExecutionTransformer 11 | }, 12 | ) => any 13 | 14 | export const decorateBuilder = (builder: BuilderCustom): BuilderCustom => 15 | function buildeDecorated(options, context, transforms = {}) { 16 | const terserOptionsCustom = (options as any).terserOptions 17 | if (terserOptionsCustom) { 18 | const webpackConfigurationOriginalTransform = transforms.webpackConfiguration 19 | transforms.webpackConfiguration = async (webpackConfig) => { 20 | if (webpackConfigurationOriginalTransform) { 21 | webpackConfig = await webpackConfigurationOriginalTransform(webpackConfig) 22 | } 23 | if ( 24 | webpackConfig.optimization && 25 | webpackConfig.optimization.minimizer && 26 | Array.isArray(webpackConfig.optimization.minimizer) 27 | ) { 28 | const terserPlugin = (webpackConfig.optimization.minimizer as any[]).find( 29 | (minimizer) => minimizer instanceof TerserPlugin, 30 | ) 31 | if (terserPlugin) { 32 | const terserOptionsOriginal = terserPlugin.options.terserOptions 33 | terserPlugin.options.terserOptions = { 34 | ...terserOptionsOriginal, 35 | ...terserOptionsCustom, 36 | } 37 | } 38 | } 39 | return webpackConfig 40 | } 41 | } 42 | 43 | return builder(options, context, transforms) 44 | } 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-builder-custom-terser-options", 3 | "version": "2.0.0-aplha.0", 4 | "description": "Angular builder that allows Terser (Uglify) customization", 5 | "main": "dist/index.js", 6 | "builders": "builders.json", 7 | "scripts": { 8 | "compile": "npx rimraf ./dist && npx tsc -p ./tsconfig.prod.json && npx copyfiles ./src/**/*.json dist", 9 | "lint": "npx tsc -p ./tsconfig.json --noEmit && npx tslint -c ./tslint.json -p ./tsconfig.json", 10 | "prepack": "npm run compile" 11 | }, 12 | "author": "keenondrums (andrey.goncharov+it@protonmail.com)", 13 | "license": "MIT", 14 | "keywords": [ 15 | "angular", 16 | "builder", 17 | "custom", 18 | "uglify", 19 | "terser" 20 | ], 21 | "dependencies": {}, 22 | "devDependencies": { 23 | "@angular-devkit/architect": "^0.802.2", 24 | "@angular-devkit/build-angular": "^0.802.2", 25 | "@angular-devkit/core": "^8.2.2", 26 | "@angular/compiler": "^8.2.2", 27 | "@angular/compiler-cli": "^8.2.2", 28 | "@angular/core": "^8.2.2", 29 | "@types/karma": "^3.0.3", 30 | "@types/terser-webpack-plugin": "^1.2.1", 31 | "@types/webpack-dev-server": "^3.1.2", 32 | "copyfiles": "^2.1.0", 33 | "doctoc": "^1.4.0", 34 | "husky": "^1.3.1", 35 | "lint-staged": "^8.1.4", 36 | "prettier": "^1.16.4", 37 | "rimraf": "^2.6.3", 38 | "terser-webpack-plugin": "^1.2.2", 39 | "tslint": "^5.12.1", 40 | "tslint-config-prettier": "^1.18.0", 41 | "tslint-config-standard": "^8.0.1", 42 | "typescript": "^3.5.3", 43 | "webpack": "^4.39.2" 44 | }, 45 | "peerDependencies": { 46 | "@angular-devkit/architect": "^0.802.2", 47 | "@angular-devkit/build-angular": "^0.802.2", 48 | "@angular-devkit/core": "^0.802.2", 49 | "@angular/compiler-cli": "^8.2.2", 50 | "@angular/compiler": "^8.2.2", 51 | "@angular/core": "^8.2.2", 52 | "terser-webpack-plugin": "^1.2.2" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angular-builder-custom-terser-options 2 | 3 | Custom Angular builder that allows Terser (Uglify) customization. It's a sub-class of Angular's default builder and it does a very small customization of its logic by extending final webpack config with your custom options for Terser. 4 | 5 | **This project is not maintained. Try https://github.com/just-jeb/angular-builders instead** 6 | 7 | 8 | 9 | 10 | - [Quick start](#quick-start) 11 | - [Common use-cases](#common-use-cases) 12 | - [Keep class names](#keep-class-names) 13 | 14 | 15 | 16 | ## Quick start 17 | 18 | 1. Install 19 | 20 | ``` 21 | npm i -D angular-builder-custom-terser-options 22 | ``` 23 | 24 | > For a builder compatible with Angular 7 run `npm i -D angular-builder-custom-terser-options@1` 25 | 26 | 1. Add builders from this package to your `angular.json`. 27 | 28 | 1. Set `projects.yourProjectName.architect.build` to `angular-builder-custom-terser-options:browser-custom-terser` 29 | 1. Set `projects.yourProjectName.architect.build.configurations.production.optimization` to `true` 30 | 1. Set `projects.yourProjectName.architect.build.configurations.production.terserOptions` to an object with any minify options supported by Terser. You can find the list of available options [here](https://github.com/terser-js/terser#minify-options). 31 | 1. Set `projects.yourProjectName.architect.serve` to `angular-builder-custom-terser-options:dev-server-custom-terser` 32 | 33 | ```js 34 | { 35 | // ... rest of the default config , 36 | "projects": { 37 | "yourProjectName": { 38 | "architect": { 39 | "build": { 40 | // Set our custom builder here 41 | "builder": "angular-builder-custom-terser-options:browser-custom-terser", 42 | "options": { 43 | // Your default options. Leave it as is 44 | }, 45 | "configurations": { 46 | "production": { 47 | // Add any options supported by Terser here 48 | "terserOptions": { 49 | "keep_classnames": true 50 | }, 51 | // Enable optimization to enable Terser itself 52 | "optimization": true 53 | } 54 | } 55 | }, 56 | "serve": { 57 | // Set our custom builder here 58 | "builder": "angular-builder-custom-terser-options:dev-server-custom-terser" 59 | // Rest of the config. Leave it as is 60 | } 61 | } 62 | } 63 | } 64 | } 65 | ``` 66 | 67 | ## Common use-cases 68 | 69 | ### Keep class names 70 | 71 | If you set `target` in your tsconfig.json to `es6` or higher, set your `terserOptions` to `{ "keep_classnames": true }`. 72 | If you set `target` in your tsconfig.json to `es5`, set your `terserOptions` to `{ "keep_fnames": true }`. 73 | -------------------------------------------------------------------------------- /src/dev-server/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "title": "Dev Server Target", 4 | "description": "Dev Server target options for Build Facade.", 5 | "type": "object", 6 | "properties": { 7 | "browserTarget": { 8 | "type": "string", 9 | "description": "Target to serve.", 10 | "pattern": ".+:.+(:.+)?" 11 | }, 12 | "port": { 13 | "type": "number", 14 | "description": "Port to listen on.", 15 | "default": 4200 16 | }, 17 | "host": { 18 | "type": "string", 19 | "description": "Host to listen on.", 20 | "default": "localhost" 21 | }, 22 | "proxyConfig": { 23 | "type": "string", 24 | "description": "Proxy configuration file." 25 | }, 26 | "ssl": { 27 | "type": "boolean", 28 | "description": "Serve using HTTPS.", 29 | "default": false 30 | }, 31 | "sslKey": { 32 | "type": "string", 33 | "description": "SSL key to use for serving HTTPS." 34 | }, 35 | "sslCert": { 36 | "type": "string", 37 | "description": "SSL certificate to use for serving HTTPS." 38 | }, 39 | "open": { 40 | "type": "boolean", 41 | "description": "Opens the url in default browser.", 42 | "default": false, 43 | "alias": "o" 44 | }, 45 | "verbose": { 46 | "type": "boolean", 47 | "description": "Adds more details to output logging." 48 | }, 49 | "liveReload": { 50 | "type": "boolean", 51 | "description": "Whether to reload the page on change, using live-reload.", 52 | "default": true 53 | }, 54 | "publicHost": { 55 | "type": "string", 56 | "description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies." 57 | }, 58 | "servePath": { 59 | "type": "string", 60 | "description": "The pathname where the app will be served." 61 | }, 62 | "disableHostCheck": { 63 | "type": "boolean", 64 | "description": "Don't verify connected clients are part of allowed hosts.", 65 | "default": false 66 | }, 67 | "hmr": { 68 | "type": "boolean", 69 | "description": "Enable hot module replacement.", 70 | "default": false 71 | }, 72 | "watch": { 73 | "type": "boolean", 74 | "description": "Rebuild on change.", 75 | "default": true 76 | }, 77 | "hmrWarning": { 78 | "type": "boolean", 79 | "description": "Show a warning when the --hmr option is enabled.", 80 | "default": true 81 | }, 82 | "servePathDefaultWarning": { 83 | "type": "boolean", 84 | "description": "Show a warning when deploy-url/base-href use unsupported serve path values.", 85 | "default": true 86 | }, 87 | "optimization": { 88 | "description": "Enables optimization of the build output.", 89 | "x-user-analytics": 16, 90 | "oneOf": [ 91 | { 92 | "type": "object", 93 | "properties": { 94 | "scripts": { 95 | "type": "boolean", 96 | "description": "Enables optimization of the scripts output.", 97 | "default": true 98 | }, 99 | "styles": { 100 | "type": "boolean", 101 | "description": "Enables optimization of the styles output.", 102 | "default": true 103 | } 104 | }, 105 | "additionalProperties": false 106 | }, 107 | { 108 | "type": "boolean" 109 | } 110 | ] 111 | }, 112 | "aot": { 113 | "type": "boolean", 114 | "description": "Build using Ahead of Time compilation.", 115 | "x-user-analytics": 13 116 | }, 117 | "sourceMap": { 118 | "description": "Output sourcemaps.", 119 | "oneOf": [ 120 | { 121 | "type": "object", 122 | "properties": { 123 | "scripts": { 124 | "type": "boolean", 125 | "description": "Output sourcemaps for all scripts.", 126 | "default": true 127 | }, 128 | "styles": { 129 | "type": "boolean", 130 | "description": "Output sourcemaps for all styles.", 131 | "default": true 132 | }, 133 | "hidden": { 134 | "type": "boolean", 135 | "description": "Output sourcemaps used for error reporting tools.", 136 | "default": false 137 | }, 138 | "vendor": { 139 | "type": "boolean", 140 | "description": "Resolve vendor packages sourcemaps.", 141 | "default": false 142 | } 143 | }, 144 | "additionalProperties": false 145 | }, 146 | { 147 | "type": "boolean" 148 | } 149 | ] 150 | }, 151 | "vendorSourceMap": { 152 | "type": "boolean", 153 | "description": "Resolve vendor packages sourcemaps.", 154 | "x-deprecated": true 155 | }, 156 | "evalSourceMap": { 157 | "type": "boolean", 158 | "description": "Output in-file eval sourcemaps.", 159 | "x-deprecated": true 160 | }, 161 | "vendorChunk": { 162 | "type": "boolean", 163 | "description": "Use a separate bundle containing only vendor libraries." 164 | }, 165 | "commonChunk": { 166 | "type": "boolean", 167 | "description": "Use a separate bundle containing code used across multiple bundles." 168 | }, 169 | "baseHref": { 170 | "type": "string", 171 | "description": "Base url for the application being built." 172 | }, 173 | "deployUrl": { 174 | "type": "string", 175 | "description": "URL where files will be deployed." 176 | }, 177 | "progress": { 178 | "type": "boolean", 179 | "description": "Log progress to the console while building." 180 | }, 181 | "poll": { 182 | "type": "number", 183 | "description": "Enable and define the file watching poll time period in milliseconds." 184 | } 185 | }, 186 | "additionalProperties": false, 187 | "required": ["browserTarget"] 188 | } 189 | -------------------------------------------------------------------------------- /src/browser/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "title": "Webpack browser schema for Build Facade.", 4 | "description": "Browser target options", 5 | "type": "object", 6 | "properties": { 7 | "assets": { 8 | "type": "array", 9 | "description": "List of static application assets.", 10 | "default": [], 11 | "items": { 12 | "$ref": "#/definitions/assetPattern" 13 | } 14 | }, 15 | "main": { 16 | "type": "string", 17 | "description": "The full path for the main entry point to the app, relative to the current workspace.", 18 | "$valueDescription": "fileName" 19 | }, 20 | "polyfills": { 21 | "type": "string", 22 | "description": "The full path for the polyfills file, relative to the current workspace." 23 | }, 24 | "tsConfig": { 25 | "type": "string", 26 | "description": "The full path for the TypeScript configuration file, relative to the current workspace." 27 | }, 28 | "scripts": { 29 | "description": "Global scripts to be included in the build.", 30 | "type": "array", 31 | "default": [], 32 | "items": { 33 | "$ref": "#/definitions/extraEntryPoint" 34 | } 35 | }, 36 | "styles": { 37 | "description": "Global styles to be included in the build.", 38 | "type": "array", 39 | "default": [], 40 | "items": { 41 | "$ref": "#/definitions/extraEntryPoint" 42 | } 43 | }, 44 | "stylePreprocessorOptions": { 45 | "description": "Options to pass to style preprocessors.", 46 | "type": "object", 47 | "properties": { 48 | "includePaths": { 49 | "description": "Paths to include. Paths will be resolved to project root.", 50 | "type": "array", 51 | "items": { 52 | "type": "string" 53 | }, 54 | "default": [] 55 | } 56 | }, 57 | "additionalProperties": false 58 | }, 59 | "terserOptions": { 60 | "description": "Overrides Terser (Uglify) options", 61 | "type": "object", 62 | "properties": {}, 63 | "additionalProperties": true 64 | }, 65 | "optimization": { 66 | "description": "Enables optimization of the build output.", 67 | "x-user-analytics": 16, 68 | "oneOf": [ 69 | { 70 | "type": "object", 71 | "properties": { 72 | "scripts": { 73 | "type": "boolean", 74 | "description": "Enables optimization of the scripts output.", 75 | "default": true 76 | }, 77 | "styles": { 78 | "type": "boolean", 79 | "description": "Enables optimization of the styles output.", 80 | "default": true 81 | } 82 | }, 83 | "additionalProperties": false 84 | }, 85 | { 86 | "type": "boolean" 87 | } 88 | ] 89 | }, 90 | "fileReplacements": { 91 | "description": "Replace files with other files in the build.", 92 | "type": "array", 93 | "items": { 94 | "$ref": "#/definitions/fileReplacement" 95 | }, 96 | "default": [] 97 | }, 98 | "outputPath": { 99 | "type": "string", 100 | "description": "The full path for the new output directory, relative to the current workspace.\n\nBy default, writes output to a folder named dist/ in the current project." 101 | }, 102 | "resourcesOutputPath": { 103 | "type": "string", 104 | "description": "The path where style resources will be placed, relative to outputPath.", 105 | "default": "" 106 | }, 107 | "aot": { 108 | "type": "boolean", 109 | "description": "Build using Ahead of Time compilation.", 110 | "x-user-analytics": 13, 111 | "default": false 112 | }, 113 | "sourceMap": { 114 | "description": "Output sourcemaps.", 115 | "default": true, 116 | "oneOf": [ 117 | { 118 | "type": "object", 119 | "properties": { 120 | "scripts": { 121 | "type": "boolean", 122 | "description": "Output sourcemaps for all scripts.", 123 | "default": true 124 | }, 125 | "styles": { 126 | "type": "boolean", 127 | "description": "Output sourcemaps for all styles.", 128 | "default": true 129 | }, 130 | "hidden": { 131 | "type": "boolean", 132 | "description": "Output sourcemaps used for error reporting tools.", 133 | "default": false 134 | }, 135 | "vendor": { 136 | "type": "boolean", 137 | "description": "Resolve vendor packages sourcemaps.", 138 | "default": false 139 | } 140 | }, 141 | "additionalProperties": false 142 | }, 143 | { 144 | "type": "boolean" 145 | } 146 | ] 147 | }, 148 | "vendorSourceMap": { 149 | "type": "boolean", 150 | "description": "Resolve vendor packages sourcemaps.", 151 | "x-deprecated": true, 152 | "default": false 153 | }, 154 | "evalSourceMap": { 155 | "type": "boolean", 156 | "description": "Output in-file eval sourcemaps.", 157 | "default": false, 158 | "x-deprecated": true 159 | }, 160 | "vendorChunk": { 161 | "type": "boolean", 162 | "description": "Use a separate bundle containing only vendor libraries.", 163 | "default": true 164 | }, 165 | "commonChunk": { 166 | "type": "boolean", 167 | "description": "Use a separate bundle containing code used across multiple bundles.", 168 | "default": true 169 | }, 170 | "baseHref": { 171 | "type": "string", 172 | "description": "Base url for the application being built." 173 | }, 174 | "deployUrl": { 175 | "type": "string", 176 | "description": "URL where files will be deployed." 177 | }, 178 | "verbose": { 179 | "type": "boolean", 180 | "description": "Adds more details to output logging.", 181 | "default": false 182 | }, 183 | "progress": { 184 | "type": "boolean", 185 | "description": "Log progress to the console while building." 186 | }, 187 | "i18nFile": { 188 | "type": "string", 189 | "description": "Localization file to use for i18n." 190 | }, 191 | "i18nFormat": { 192 | "type": "string", 193 | "description": "Format of the localization file specified with --i18n-file." 194 | }, 195 | "i18nLocale": { 196 | "type": "string", 197 | "description": "Locale to use for i18n." 198 | }, 199 | "i18nMissingTranslation": { 200 | "type": "string", 201 | "description": "How to handle missing translations for i18n." 202 | }, 203 | "extractCss": { 204 | "type": "boolean", 205 | "description": "Extract css from global styles into css files instead of js ones.", 206 | "default": false 207 | }, 208 | "watch": { 209 | "type": "boolean", 210 | "description": "Run build when files change.", 211 | "default": false 212 | }, 213 | "outputHashing": { 214 | "type": "string", 215 | "description": "Define the output filename cache-busting hashing mode.", 216 | "default": "none", 217 | "enum": ["none", "all", "media", "bundles"] 218 | }, 219 | "poll": { 220 | "type": "number", 221 | "description": "Enable and define the file watching poll time period in milliseconds." 222 | }, 223 | "deleteOutputPath": { 224 | "type": "boolean", 225 | "description": "Delete the output path before building.", 226 | "default": true 227 | }, 228 | "preserveSymlinks": { 229 | "type": "boolean", 230 | "description": "Do not use the real path when resolving modules.", 231 | "default": false 232 | }, 233 | "extractLicenses": { 234 | "type": "boolean", 235 | "description": "Extract all licenses in a separate file.", 236 | "default": false 237 | }, 238 | "showCircularDependencies": { 239 | "type": "boolean", 240 | "description": "Show circular dependency warnings on builds.", 241 | "default": true 242 | }, 243 | "buildOptimizer": { 244 | "type": "boolean", 245 | "description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.", 246 | "default": false 247 | }, 248 | "namedChunks": { 249 | "type": "boolean", 250 | "description": "Use file name for lazy loaded chunks.", 251 | "default": true 252 | }, 253 | "subresourceIntegrity": { 254 | "type": "boolean", 255 | "description": "Enables the use of subresource integrity validation.", 256 | "default": false 257 | }, 258 | "serviceWorker": { 259 | "type": "boolean", 260 | "description": "Generates a service worker config for production builds.", 261 | "default": false 262 | }, 263 | "ngswConfigPath": { 264 | "type": "string", 265 | "description": "Path to ngsw-config.json." 266 | }, 267 | "skipAppShell": { 268 | "type": "boolean", 269 | "description": "Flag to prevent building an app shell.", 270 | "default": false, 271 | "x-deprecated": true 272 | }, 273 | "index": { 274 | "description": "Configures the generation of the application's HTML index.", 275 | "oneOf": [ 276 | { 277 | "type": "string", 278 | "description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path." 279 | }, 280 | { 281 | "type": "object", 282 | "description": "", 283 | "properties": { 284 | "input": { 285 | "type": "string", 286 | "minLength": 1, 287 | "description": "The path of a file to use for the application's generated HTML index." 288 | }, 289 | "output": { 290 | "type": "string", 291 | "minLength": 1, 292 | "default": "index.html", 293 | "description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path." 294 | } 295 | }, 296 | "required": ["input"] 297 | } 298 | ] 299 | }, 300 | "statsJson": { 301 | "type": "boolean", 302 | "description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.", 303 | "default": false 304 | }, 305 | "forkTypeChecker": { 306 | "type": "boolean", 307 | "description": "Run the TypeScript type checker in a forked process.", 308 | "default": true 309 | }, 310 | "lazyModules": { 311 | "description": "List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.", 312 | "type": "array", 313 | "items": { 314 | "type": "string" 315 | }, 316 | "default": [] 317 | }, 318 | "budgets": { 319 | "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.", 320 | "type": "array", 321 | "items": { 322 | "$ref": "#/definitions/budget" 323 | }, 324 | "default": [] 325 | }, 326 | "profile": { 327 | "type": "boolean", 328 | "description": "Output profile events for Chrome profiler.", 329 | "default": false, 330 | "x-deprecated": "Use \"NG_BUILD_PROFILING\" environment variable instead." 331 | }, 332 | "es5BrowserSupport": { 333 | "description": "Enables conditionally loaded ES2015 polyfills.", 334 | "type": "boolean", 335 | "x-deprecated": "This will be determined from the list of supported browsers specified in the 'browserslist' file." 336 | }, 337 | "rebaseRootRelativeCssUrls": { 338 | "description": "Change root relative URLs in stylesheets to include base HREF and deploy URL. Use only for compatibility and transition. The behavior of this option is non-standard and will be removed in the next major release.", 339 | "type": "boolean", 340 | "default": false, 341 | "x-deprecated": true 342 | }, 343 | "webWorkerTsConfig": { 344 | "type": "string", 345 | "description": "TypeScript configuration for Web Worker modules." 346 | }, 347 | "crossOrigin": { 348 | "type": "string", 349 | "description": "Define the crossorigin attribute setting of elements that provide CORS support.", 350 | "default": "none", 351 | "enum": ["none", "anonymous", "use-credentials"] 352 | } 353 | }, 354 | "additionalProperties": false, 355 | "required": ["outputPath", "index", "main", "tsConfig"], 356 | "definitions": { 357 | "assetPattern": { 358 | "oneOf": [ 359 | { 360 | "type": "object", 361 | "properties": { 362 | "glob": { 363 | "type": "string", 364 | "description": "The pattern to match." 365 | }, 366 | "input": { 367 | "type": "string", 368 | "description": "The input directory path in which to apply 'glob'. Defaults to the project root." 369 | }, 370 | "ignore": { 371 | "description": "An array of globs to ignore.", 372 | "type": "array", 373 | "items": { 374 | "type": "string" 375 | } 376 | }, 377 | "output": { 378 | "type": "string", 379 | "description": "Absolute path within the output." 380 | } 381 | }, 382 | "additionalProperties": false, 383 | "required": ["glob", "input", "output"] 384 | }, 385 | { 386 | "type": "string" 387 | } 388 | ] 389 | }, 390 | "fileReplacement": { 391 | "oneOf": [ 392 | { 393 | "type": "object", 394 | "properties": { 395 | "src": { 396 | "type": "string" 397 | }, 398 | "replaceWith": { 399 | "type": "string" 400 | } 401 | }, 402 | "additionalProperties": false, 403 | "required": ["src", "replaceWith"] 404 | }, 405 | { 406 | "type": "object", 407 | "properties": { 408 | "replace": { 409 | "type": "string" 410 | }, 411 | "with": { 412 | "type": "string" 413 | } 414 | }, 415 | "additionalProperties": false, 416 | "required": ["replace", "with"] 417 | } 418 | ] 419 | }, 420 | "extraEntryPoint": { 421 | "oneOf": [ 422 | { 423 | "type": "object", 424 | "properties": { 425 | "input": { 426 | "type": "string", 427 | "description": "The file to include." 428 | }, 429 | "bundleName": { 430 | "type": "string", 431 | "description": "The bundle name for this extra entry point." 432 | }, 433 | "lazy": { 434 | "type": "boolean", 435 | "description": "If the bundle will be lazy loaded.", 436 | "default": false, 437 | "x-deprecated": "Use 'inject' option with 'false' value instead." 438 | }, 439 | "inject": { 440 | "type": "boolean", 441 | "description": "If the bundle will be referenced in the HTML file.", 442 | "default": true 443 | } 444 | }, 445 | "additionalProperties": false, 446 | "required": ["input"] 447 | }, 448 | { 449 | "type": "string", 450 | "description": "The file to include." 451 | } 452 | ] 453 | }, 454 | "budget": { 455 | "type": "object", 456 | "properties": { 457 | "type": { 458 | "type": "string", 459 | "description": "The type of budget.", 460 | "enum": ["all", "allScript", "any", "anyScript", "anyComponentStyle", "bundle", "initial"] 461 | }, 462 | "name": { 463 | "type": "string", 464 | "description": "The name of the bundle." 465 | }, 466 | "baseline": { 467 | "type": "string", 468 | "description": "The baseline size for comparison." 469 | }, 470 | "maximumWarning": { 471 | "type": "string", 472 | "description": "The maximum threshold for warning relative to the baseline." 473 | }, 474 | "maximumError": { 475 | "type": "string", 476 | "description": "The maximum threshold for error relative to the baseline." 477 | }, 478 | "minimumWarning": { 479 | "type": "string", 480 | "description": "The minimum threshold for warning relative to the baseline." 481 | }, 482 | "minimumError": { 483 | "type": "string", 484 | "description": "The minimum threshold for error relative to the baseline." 485 | }, 486 | "warning": { 487 | "type": "string", 488 | "description": "The threshold for warning relative to the baseline (min & max)." 489 | }, 490 | "error": { 491 | "type": "string", 492 | "description": "The threshold for error relative to the baseline (min & max)." 493 | } 494 | }, 495 | "additionalProperties": false, 496 | "required": ["type"] 497 | } 498 | } 499 | } 500 | --------------------------------------------------------------------------------