-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
56 lines (49 loc) · 1.34 KB
/
next.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
const withNextAntdLess = require('./next-antd-less.config');
const withCss = require('@zeit/next-css');
const withPlugins = require('next-compose-plugins');
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
const fs = require('fs');
const packageJson = fs.readFileSync('./package.json');
const version = JSON.parse(packageJson).version || 0;
module.exports = withPlugins(
[
[withCss, {}],
[
withNextAntdLess,
{
lessVarsFilePath: './styles/variables.module.less',
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
camelCase: true,
localIdentName: '[name]_[local]___[hash:base64:5]',
},
},
],
],
{
webpack: (config, { webpack }) => {
config.plugins.push(
new FilterWarningsPlugin({
exclude: /Conflicting order/,
}),
);
config.plugins.push(
new webpack.EnvironmentPlugin({
PACKAGE_VERSION: version,
}),
);
config.plugins.push(
new webpack.ContextReplacementPlugin(/\/@commitlint\/resolve-extends\//, (data) => {
delete data.dependencies[0].critical;
return data;
}),
);
config.module.unknownContextCritical = false;
config.node = {
__dirname: true,
};
return config;
},
},
);