Repository navigation
Expand file tree
/
Copy pathnext.config.mts
More file actions
72 lines (59 loc) · 1.96 KB
/
Copy pathnext.config.mts
File metadata and controls
72 lines (59 loc) · 1.96 KB
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
66
67
68
69
70
71
72
import { execFileSync } from 'node:child_process'
import process from 'node:process'
import type { NextConfig } from 'next'
import { withAmamoMdx } from '@amamo/mdx/next'
import createNextIntlPlugin from 'next-intl/plugin'
import amamo from './amamo.config.mts'
const withNextIntl = createNextIntlPlugin()
const DEV_API_ORIGIN = 'https://dev.univer.plus'
function getDocsSourceRef() {
const configuredRef =
process.env.NEXT_PUBLIC_DOCS_SOURCE_REF || process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME
if (configuredRef) return configuredRef
try {
return execFileSync('git', ['branch', '--show-current'], { encoding: 'utf8' }).trim() || 'dev'
} catch {
return 'dev'
}
}
const config: NextConfig = {
agentRules: false,
// MDX modules also need Next's server React and JSX runtime aliases.
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
reactStrictMode: true,
env: {
// The browser SDK validates this client license, so it is included in the client bundle.
NEXT_PUBLIC_CLIENT_LICENSE_TEXT: process.env.CLIENT_LICENSE_TEXT ?? '',
NEXT_PUBLIC_DOCS_SOURCE_REF: getDocsSourceRef(),
},
allowedDevOrigins: ['*'],
output: 'standalone',
outputFileTracingIncludes: {
'/*': [
'.amamo-mdx/index.json',
'.amamo-mdx/guides-navigation.json',
'content/**/*.json',
'content/**/*.mdx',
'node_modules/.pnpm/@swc+helpers@*/node_modules/@swc/helpers/esm/**/*',
],
},
experimental: {
// Hoisted Pro PDF code loses decoder assignments during minification.
turbopackScopeHoisting: false,
turbopackRemoveUnusedImports: false,
turbopackRemoveUnusedExports: false,
},
typescript: {
ignoreBuildErrors: true,
},
async rewrites() {
if (process.env.NODE_ENV !== 'development') return []
return [
{
source: '/universer-api/:path*',
destination: `${DEV_API_ORIGIN}/universer-api/:path*`,
},
]
},
}
export default withAmamoMdx(amamo)(withNextIntl(config))