-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
29 lines (26 loc) · 916 Bytes
/
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
const path = require('path');
const { merge } = require('webpack-merge');
const {
mode, folder, host, port,
} = require('webpack-nano/argv');
const { getCommon } = require('./.config/webpack/common');
const outputPath = path.resolve(__dirname, folder || 'dist');
const sourcePath = path.resolve(__dirname, 'src');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const nodeCachePath = path.resolve(nodeModulesPath, '.cache');
const configPath = path.resolve(__dirname, '.config');
const options = {
outputPath,
sourcePath,
nodeModulesPath,
nodeCachePath,
configPath,
host,
port,
};
const getModeConfig = mode === 'development'
? require('./.config/webpack/development')
: require('./.config/webpack/production');
const commonConfig = getCommon(options);
const modeConfig = getModeConfig(options);
module.exports = merge(commonConfig, modeConfig, { mode });