diff --git a/packages/angular-cli/lib/config/schema.d.ts b/packages/angular-cli/lib/config/schema.d.ts index 1f5ea0d0d526..796ce42cd498 100644 --- a/packages/angular-cli/lib/config/schema.d.ts +++ b/packages/angular-cli/lib/config/schema.d.ts @@ -32,6 +32,10 @@ export interface CliConfig { */ environments?: { [name: string]: any; + /** + * Webpack target config. + */ + target?: string; }; }[]; /** diff --git a/packages/angular-cli/lib/config/schema.json b/packages/angular-cli/lib/config/schema.json index 2334acd76427..7cbbca28e0dc 100644 --- a/packages/angular-cli/lib/config/schema.json +++ b/packages/angular-cli/lib/config/schema.json @@ -110,6 +110,10 @@ "description": "Name and corresponding file for environment config.", "type": "object", "additionalProperties": true + }, + "target": { + "description": "Webpack target config.", + "type": "string" } }, "additionalProperties": false diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index d44226a798bf..58e324a6bce1 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -37,6 +37,7 @@ export function getWebpackCommonConfig( const appRoot = path.resolve(projectRoot, appConfig.root); const appMain = path.resolve(appRoot, appConfig.main); const nodeModules = path.resolve(projectRoot, 'node_modules'); + const target = appConfig.target || 'web'; let extraPlugins: any[] = []; let extraRules: any[] = []; @@ -171,6 +172,7 @@ export function getWebpackCommonConfig( }, }) ].concat(extraPlugins), + target: target, node: { fs: 'empty', global: true,