-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
116 lines (112 loc) · 3.05 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const AntDesignThemePlugin = require('antd-theme-webpack-plugin');
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin')
const env = require('dotenv').config();
const options = {
antDir: path.join(__dirname, './node_modules/antd'),
stylesDir: path.join(__dirname, './src/css'),
varFile: path.join(__dirname, './src/css/defaultTheme.less'),
mainLessFile: path.join(__dirname, './src/css/index.less'),
themeVariables: [
'@primary-color',
'@info-color',
'@warning-color',
'@highlight-color',
'@body-background',
'@component-background',
'@heading-color',
'@text-color',
'@border-color-base',
'@border-color-split',
'@layout-body-background',
'@layout-header-background',
'@layout-sider-background',
'@layout-trigger-background',
'@layout-trigger-color',
'@disabled-color',
'@background-color-light',
'@background-color-base',
'@item-active-bg',
'@item-hover-bg',
'@btn-default-bg',
'@input-bg',
'@popover-bg',
'@menu-dark-submenu-bg',
'@table-header-bg',
'@table-row-hover-bg',
'@table-selected-row-bg',
'@table-expanded-row-bg',
'@tag-default-bg',
'@collapse-header-bg',
'@card-head-color',
'@card-head-background',
'@card-actions-background',
'@card-background',
'@modal-mask-bg',
],
indexFileName: 'app.html',
generateOnce: false,
lessUrl: "https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js",
publicPath: "",
customColorRegexArray: [], // An array of regex codes to match your custom color variable values so that code can identify that it's a valid color. Make sure your regex does not adds false positives.
}
module.exports = {
mode: process.env.NODE_ENV,
entry: {
app: './src/App.jsx',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: [/node_modules/, /coverage/, /eslint/, /que-series/],
loader: "babel-loader"
},
{
test: /\.less$/,
use: [{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}, {
loader: 'less-loader', // compiles Less to CSS
options: {
javascriptEnabled: true
}
},
]},
{
test: /\.css$/,
exclude: /node_modules/,
use: ["style-loader",'css-loader']
},
{
test: /\.(png|svg|jpg|gif)$/,
exclude: /node_modules/,
use: ['file-loader']
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: ['file-loader'],
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/app.html',
chunks : ['app'],
filename: 'app.html'
}),
new AntDesignThemePlugin(options),
new ErrorOverlayPlugin()
],
devtool: 'cheap-module-source-map',
}