2018-11-02 19:50:30 +01:00
|
|
|
const withCSS = require('@zeit/next-css')
|
2017-05-27 14:22:13 +02:00
|
|
|
|
2019-06-04 11:13:11 +02:00
|
|
|
module.exports = withCSS({
|
|
|
|
webpack: (config, { isServer }) => {
|
|
|
|
if (isServer) {
|
|
|
|
const antStyles = /antd-mobile\/.*?\/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)
|
|
|
|
]
|
2017-05-27 14:22:13 +02:00
|
|
|
|
2019-06-04 11:13:11 +02:00
|
|
|
config.module.rules.unshift({
|
|
|
|
test: antStyles,
|
|
|
|
use: 'null-loader'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return config
|
|
|
|
}
|
|
|
|
})
|