Skip to content

Commit e3a4e01

Browse files
author
Maxime GRIS
committed
ref/ clean custom webpack target ('electron-renderer' or 'web')
1 parent 85aaf86 commit e3a4e01

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

angular.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@
119119
"src/assets"
120120
],
121121
"customWebpackConfig": {
122-
"path": "./angular.webpack.js",
123-
"target": "electron-renderer"
122+
"path": "./angular.webpack.js"
124123
}
125124
}
126125
},

angular.webpack.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
module.exports = (config, options) => {
66
config.target = 'electron-renderer';
7-
if (options.customWebpackConfig.target) {
8-
config.target = options.customWebpackConfig.target;
9-
} else if (options.fileReplacements) {
7+
8+
9+
if (options.fileReplacements) {
1010
for(let fileReplacement of options.fileReplacements) {
1111
if (fileReplacement.replace !== 'src/environments/environment.ts') {
1212
continue;
1313
}
1414

1515
let fileReplacementParts = fileReplacement['with'].split('.');
16-
if (['dev', 'prod', 'test', 'electron-renderer'].indexOf(fileReplacementParts[1]) < 0) {
17-
config.target = fileReplacementParts[1];
16+
if (fileReplacementParts.length > 1 && ['web'].indexOf(fileReplacementParts[1]) >= 0) {
17+
config.target = 'web';
1818
}
1919
break;
2020
}

src/environments/environment.dev.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// The file contents for the current environment will overwrite these during build.
2-
// The build system defaults to the dev environment which uses `index.ts`, but if you do
3-
// `ng build --env=prod` then `index.prod.ts` will be used instead.
4-
// The list of which env maps to which file can be found in `.angular-cli.json`.
5-
61
export const AppConfig = {
72
production: false,
83
environment: 'DEV'

src/environments/environment.web.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// The file contents for the current environment will overwrite these during build.
2-
// The build system defaults to the dev environment which uses `index.ts`, but if you do
3-
// `ng build --env=prod` then `index.prod.ts` will be used instead.
4-
// The list of which env maps to which file can be found in `.angular-cli.json`.
5-
61
export const AppConfig = {
72
production: false,
8-
environment: 'DEV'
3+
environment: 'WEB'
94
};

0 commit comments

Comments
 (0)