-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config1.js
48 lines (44 loc) · 1.13 KB
/
next.config1.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
// next.config.js
const antdLessLoader = require('next-antd-aza-less');
const withLess = require('@zeit/next-less');
const withCSS = require('@zeit/next-css');
const fs = require('fs');
const path = require('path');
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
const lessToJS = require('less-vars-to-js');
/*module.exports = withCSS(
withLess({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]',
}
}),
);*/
if (typeof require !== 'undefined') {
require.extensions['.less'] = file => {
};
}
module.exports = withCSS(antdLessLoader({
publicRuntimeConfig: {APP_ENV: process.env.APP_ENV},
webpack: config => {
config.plugins.push(
//解决css加载顺序警告
new FilterWarningsPlugin({
exclude: /mini-css-extract-plugin[^]*Conflicting order between:/
})
);
return config;
},
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: '[local]___[hash:base64:5]'
},
lessLoaderOptions: {
javascriptEnabled: true,
modifyVars: lessToJS(
fs.readFileSync(path.resolve(__dirname, './util/antd.less'), 'utf8')
)
}
}));