ref/ clean custom webpack target ('electron-renderer' or 'web')

This commit is contained in:
Maxime GRIS
2020-08-15 12:38:59 +02:00
parent 85aaf86e57
commit e3a4e01a0e
4 changed files with 7 additions and 18 deletions

View File

@@ -119,8 +119,7 @@
"src/assets"
],
"customWebpackConfig": {
"path": "./angular.webpack.js",
"target": "electron-renderer"
"path": "./angular.webpack.js"
}
}
},

View File

@@ -4,17 +4,17 @@
module.exports = (config, options) => {
config.target = 'electron-renderer';
if (options.customWebpackConfig.target) {
config.target = options.customWebpackConfig.target;
} else if (options.fileReplacements) {
if (options.fileReplacements) {
for(let fileReplacement of options.fileReplacements) {
if (fileReplacement.replace !== 'src/environments/environment.ts') {
continue;
}
let fileReplacementParts = fileReplacement['with'].split('.');
if (['dev', 'prod', 'test', 'electron-renderer'].indexOf(fileReplacementParts[1]) < 0) {
config.target = fileReplacementParts[1];
if (fileReplacementParts.length > 1 && ['web'].indexOf(fileReplacementParts[1]) >= 0) {
config.target = 'web';
}
break;
}

View File

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

View File

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