-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
38 lines (36 loc) · 983 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
30
31
32
33
34
35
36
37
38
// const AntdScssThemePlugin = require('antd-scss-theme-plugin');
// AntdScssThemePlugin.themify({
// loader: 'sass-loader',
// options: {
// sourceMap: process.env.NODE_ENV !== 'production',
// },
// })
// const webpackConfig = {
// // ...
// plugins: [
// new AntdScssThemePlugin('./theme.scss'),
// ],
// };
const { getThemeVariables } = require('antd/dist/theme');
// webpack.config.js
module.exports = {
rules: [{
test: /\.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
}, {
loader: 'less-loader', // compiles Less to CSS
options: {
lessOptions: { // 如果使用less-loader@5,请移除 lessOptions 这一级直接配置选项。
modifyVars: getThemeVariables({
dark: true, // 开启暗黑模式
compact: true, // 开启紧凑模式
}),
javascriptEnabled: true,
},
},
}],
}],
};