-
Notifications
You must be signed in to change notification settings - Fork 23
/
ngw.config.ts
64 lines (47 loc) · 1.39 KB
/
ngw.config.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as webpack from 'webpack';
import { WebpackConfigOptions as ConfigOptions } from '@angular/cli/models/webpack-config';
import { BuildOptions } from '@angular/cli/models/build-options';
import node from 'file.node';
import * as path from 'path';
import * as resolve from 'resolve';
import * as WatchIgnorePlugin from 'watch-ignore-webpack-plugin';
export type Configuration = webpack.Configuration;
const DEFAULT_COMMAND = process.argv[2];
export default function (config: Configuration, options: ConfigOptions<BuildOptions>, argv) {
console.log('For modify webpack build, you can usage ngw.config.ts');
const command = argv || DEFAULT_COMMAND;
let rule = {};
switch(options.buildOptions.environment)
{
case 'prod':
rule = {
test: /\.node?$/,
use: [
{
loader: 'electron-node-loader-chimaera',
options: {
folder: './node_modules/zeromq/build/Release',
prod: true
}
}
]
};
break
case 'dev':
rule = {
test: /\.node?$/,
use: [
{
loader: 'electron-node-loader-chimaera',
options: {
folder: path.resolve(__dirname, './node_modules/zeromq/build/Release')
}
}
]
};
break
}
config.module.rules.push(rule);
config.plugins.push(new WatchIgnorePlugin([path.resolve(__dirname, './daemon/datadir')]));
return config;
}