-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
64 lines (52 loc) · 1.68 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
57
58
59
60
61
62
63
64
// module.exports = {
// webpack: config => {
// // Fixes npm packages that depend on `fs` module
// config.node = {
// fs: 'empty'
// }
// return config
// }
// }
const { PHASE_PRODUCTION_SERVER } =
process.env.NODE_ENV === 'development'
? {} // We're never in "production server" phase when in development mode
: !process.env.NOW_REGION
? require('next/constants') // Get values from `next` package when building locally
: require('next-server/constants'); // Get values from `next-server` package when building on now v2
module.exports = (phase, { defaultConfig }) => {
if (phase === PHASE_PRODUCTION_SERVER) {
// Config used to run in production.
return {};
}
/* eslint-disable */
const withLess = require('@zeit/next-less')
const lessToJS = require('less-vars-to-js')
const fs = require('fs')
const path = require('path')
// Where your antd-custom.less file lives
const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, './assets/antd-custom.less'), 'utf8')
)
// fix: prevents error when .less files are required by node
if (typeof require !== 'undefined') {
require.extensions['.less'] = file => {}
}
return withLess({
lessLoaderOptions: {
javascriptEnabled: true,
modifyVars: themeVariables // make your antd custom effective
}
})
};
// /* eslint-disable */
// const withCSS = require('@zeit/next-css')
// // fix: prevents error when .css files are required by node
// if (typeof require !== 'undefined') {
// require.extensions['.css'] = file => {}
// }
// // module.exports = withCss()
// module.exports = withCSS({
// cssLoaderOptions: {
// url: true
// }
// })