Skip to content
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
2 changes: 1 addition & 1 deletion packages/@angular/cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
"platform": {
"type": "string",
"enum": ["browser", "server"],
"enum": ["browser", "server", "electron"],
"default": "browser",
"description": "The runtime platform of the app."
},
Expand Down
6 changes: 5 additions & 1 deletion packages/@angular/cli/models/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getProdConfig,
getStylesConfig,
getServerConfig,
getElectronConfig,
getNonAotConfig,
getAotConfig
} from './webpack-configs';
Expand Down Expand Up @@ -38,7 +39,10 @@ export class NgCliWebpackConfig {

public buildConfig() {
const platformConfig = this.wco.appConfig.platform === 'server' ?
getServerConfig(this.wco) : getBrowserConfig(this.wco);
getServerConfig(this.wco) :
this.wco.appConfig.platform === 'electron' ?
getElectronConfig(this.wco) :
getBrowserConfig(this.wco);

let webpackConfigs = [
getCommonConfig(this.wco),
Expand Down
9 changes: 9 additions & 0 deletions packages/@angular/cli/models/webpack-configs/electron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { WebpackConfigOptions } from '../webpack-config';

import { getBrowserConfig } from './browser';

export function getElectronConfig(wco: WebpackConfigOptions) {
const config = <any>getBrowserConfig(wco);
config.target = 'electron-renderer';
return config;
}
1 change: 1 addition & 0 deletions packages/@angular/cli/models/webpack-configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './common';
export * from './development';
export * from './production';
export * from './server';
export * from './electron';
export * from './styles';
export * from './test';
export * from './typescript';
Expand Down
3 changes: 3 additions & 0 deletions packages/@angular/cli/tasks/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export default Task.extend({
if (appConfig.platform === 'server') {
throw new SilentError('ng serve for platform server applications is coming soon!');
}
if (appConfig.platform === 'electron') {
throw new SilentError('ng serve for platform electron applications is not supported.');
}
if (serveTaskOptions.deleteOutputPath) {
fs.removeSync(path.resolve(this.project.root, outputPath));
}
Expand Down