-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (47 loc) · 1.77 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const devServer = require('./webpack/devServer');
const entry = require('./webpack/entry');
const loaders = require('./webpack/loaders');
const optimizations = require('./webpack/optimizations');
const output = require('./webpack/output');
const performance = require('./webpack/performance');
const plugins = require('./webpack/plugins');
const resolve = require('./webpack/resolve');
const { BROWSER_TYPES, ENVIRONMENTS } = require('./build/global/environments');
const ENV = process.env.NODE_ENV;
const isProduction = ENV === ENVIRONMENTS.PRODUCTION;
console.log('**********************************************');
console.log('********** WEBPACK NODE ENVIRONMENT **********');
console.log(ENV);
if (!isProduction) {
console.log('********** WEBPACK CONFIG DEV SERVER *********');
console.log(devServer);
console.log('************ WEBPACK CONFIG ENTRY ************');
console.log(entry);
console.log('*********** WEBPACK CONFIG LOADERS ***********');
console.log(loaders);
console.log('********* WEBPACK CONFIG OPTIMIZATIONS *******');
console.log(optimizations);
console.log('*********** WEBPACK CONFIG OUTPUT ************');
console.log(output);
console.log('*********** WEBPACK CONFIG PLUGINS ***********');
console.log(plugins);
console.log('*********** WEBPACK CONFIG RESOLVE ***********');
console.log(resolve);
console.log('************* WEBPACK CONFIG END *************');
}
console.log('**********************************************');
module.exports = {
devServer,
devtool: !isProduction ? 'eval-cheap-module-source-map' : false,
entry,
mode: ENV,
module: {
rules: loaders(ENV),
},
...(isProduction && { performance }),
plugins: plugins(ENV),
optimization: optimizations(ENV),
output: output(ENV),
resolve,
target: BROWSER_TYPES.WEB,
};