Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add webpack target configuration via angular-cli.json #3346

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/angular-cli/lib/config/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export interface CliConfig {
*/
environments?: {
[name: string]: any;
/**
* Webpack target config.
*/
target?: string;
};
}[];
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/angular-cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/angular-cli/models/webpack-build-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down Expand Up @@ -171,6 +172,7 @@ export function getWebpackCommonConfig(
},
})
].concat(extraPlugins),
target: target,
node: {
fs: 'empty',
global: true,
Expand Down