-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathangular.webpack.js
31 lines (26 loc) · 952 Bytes
/
angular.webpack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Custom angular webpack configuration
*/
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (config, options) => {
config.target = 'electron-renderer';
config.plugins.push(new CopyWebpackPlugin([{
from: 'node_modules/monaco-editor/min/vs',
to: 'vs',
}]));
if (options.customWebpackConfig.target) {
config.target = options.customWebpackConfig.target;
} else 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];
}
break;
}
}
return config;
}