forked from Fental/univer-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
65 lines (55 loc) · 1.5 KB
/
next.config.mjs
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
65
import { UniverPlugin } from '@univerjs/webpack-plugin'
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'
import Nextra from 'nextra'
const withNextra = Nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
})
/** @type {import('next').NextConfig} */
const nextConfig = {
// swcMinify: false,
reactStrictMode: false,
transpilePackages: ['monaco-editor'],
output: 'standalone',
i18n: {
locales: ['en-US', 'zh-CN'],
defaultLocale: 'en-US',
localeDetection: false,
},
rewrites: () => {
// eslint-disable-next-line node/prefer-global/process
if (process.env.UNIVEERSER_ENDPOINT) {
return [
{
source: '/universer-api/:path*',
// eslint-disable-next-line node/prefer-global/process
destination: `${process.env.UNIVEERSER_ENDPOINT}/universer-api/:path*`,
},
]
}
return []
},
webpack: (config, { isServer }) => {
config.plugins.push(new UniverPlugin())
config.module.rules.push({
test: /\.txt$/i,
use: 'raw-loader',
})
config.module.rules.push({
test: /\.d\.ts$/,
loader: 'ignore-loader',
})
if (!isServer) {
// https://github.com/vercel/next.js/issues/31692
config.plugins.push(
new MonacoWebpackPlugin({
languages: ['typescript'],
filename: 'static/[name].worker.js',
}),
)
config.optimization.minimize = false
}
return config
},
}
export default withNextra(nextConfig)