forked from camptocamp/ngeo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
37 lines (32 loc) · 1.15 KB
/
webpack.config.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
32
33
34
35
36
37
const webpackMerge = require('webpack-merge');
module.exports = (env, args) => {
const nodeEnv = args.mode || 'production';
process.env['NODE_ENV'] = nodeEnv;
let config = require('./buildtools/webpack.commons')();
switch (nodeEnv) {
case 'development':
config = webpackMerge(config, require('./buildtools/webpack.dev')());
break;
case 'production':
config = webpackMerge(config, require('./buildtools/webpack.prod')());
break;
default:
console.log(`The 'NODE_ENV' environment variable is set to an invalid value: ${process.env.NODE_ENV}.`);
process.exit(2);
}
switch (process.env.TARGET) {
case 'ngeo-examples':
config = webpackMerge(config, require('./buildtools/webpack.ngeoexamples'));
break;
case 'gmf-examples':
config = webpackMerge(config, require('./buildtools/webpack.gmfexamples'));
break;
case 'gmf-apps':
config = webpackMerge(config, require('./buildtools/webpack.gmfapps'));
break;
default:
console.log(`The 'TARGET' environment variable is set to an invalid value: ${process.env.TARGET}.`);
process.exit(2);
}
return config;
};