-
-
Save ueaner/51ac7d0aabea2dbf1d4c06830f4fae7c to your computer and use it in GitHub Desktop.
Nextjs project with antd and saas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const withCss = require('@zeit/next-css') | |
| const withSaas = require('@zeit/next-sass') | |
| module.exports = withCss(withSaas({ | |
| webpack: (config, { isServer }) => { | |
| if (isServer) { | |
| const antStyles = /antd\/.*?\/style\/css.*?/ | |
| 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 | |
| }, | |
| })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment