mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
/* 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, './styles/antd-override.less'), 'utf8')
|
|
)
|
|
|
|
module.exports = withLess({
|
|
lessLoaderOptions: {
|
|
javascriptEnabled: true,
|
|
modifyVars: themeVariables, // make your antd custom effective
|
|
},
|
|
webpack: (config, { isServer }) => {
|
|
if (isServer) {
|
|
const antStyles = /antd\/.*?\/style.*?/
|
|
const origExternals = [...config.externals]
|
|
config.externals = [
|
|
(context, request, callback) => {
|
|
if (request.match(antStyles)) return callback()
|
|
if (typeof origExternals[0] === 'function') {
|
|
origExternals[0](context, request, callback)
|
|
} else {
|
|
callback()
|
|
}
|
|
},
|
|
...(typeof origExternals[0] === 'function' ? [] : origExternals),
|
|
]
|
|
|
|
config.module.rules.unshift({
|
|
test: antStyles,
|
|
use: 'null-loader',
|
|
})
|
|
}
|
|
return config
|
|
},
|
|
})
|