-
Notifications
You must be signed in to change notification settings - Fork 54
/
next.config.js
33 lines (27 loc) · 971 Bytes
/
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
const withLess = require('next-with-less')
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/
})
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
})
const path = require('path')
const pathToLessFileWithVariables = path.resolve(__dirname, './assets/antd-custom.less')
const config = withBundleAnalyzer(withMDX(withLess({
pageExtensions: ['js', 'jsx', 'md', 'mdx'],
lessLoaderOptions: {
/* ... */
additionalData: (content) =>
`${content}\n\n@import '${pathToLessFileWithVariables}';`
}
})))
if (process.env.NODE_ENV === 'test') {
// use a unique next distDir for each test
const { v4: uuid } = require('uuid')
config.distDir = path.join('.test', uuid())
}
const env = require('./config/importEncryptedEnv')() // this will import during build step
module.exports = {
...config,
env // It's required to pass environment variables here to pass them into the frontend code
}