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
| const path = require('path');
|
| module.exports = function ({
| target,
| entry,
| htmls,
| basedir
| }) {
| const resolve = {
| extensions: [".js", ".jsx", ".ts", ".tsx"]
| };
| const output = {
| path: path.join(basedir, target),
| filename: '[name].js?[hash]'
| };
| const module = {
| rules: require('./rules')
| };
| const plugins = require('./plugins')(target, basedir, htmls);
| const config = {
| entry,
| output,
| module,
| resolve,
| plugins
| };
| if (target === 'dist') {
| config.mode = 'production';
| config.devtool = 'none';
| } else {
| config.mode = 'development';
| config.devtool = 'inline-source-map';
| }
| return config;
| };
|
|