generated from SuhushinAS/react-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (44 loc) · 1.1 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
const path = require('path');
const {merge} = require('webpack-merge');
const asset = require('./config/asset');
const base = require('./config/base');
const html = require('./config/html');
const optimization = require('./config/optimization');
const script = require('./config/script');
const style = require('./config/style');
const svg = require('./config/svg');
/**
* Получить конфигурацию webpack.
* @param env Окружение.
* @param argv Аргументы
* @returns {*} Конфигурация webpack.
*/
function webpackConfig(env, argv) {
const {mode} = argv;
const root = __dirname;
const options = {
dist: path.join(root, 'www'),
mode,
pages: ['index'],
public: path.join(root, 'public'),
root,
src: 'src',
};
const clean = 'production' === mode ? true : {keep: /\.svg$/u};
const result = {
output: {
clean,
},
};
return merge(
asset(options),
base(options),
html(options),
optimization(options),
script(options),
style(options),
svg(options),
result
);
}
module.exports = webpackConfig;