-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathnext.config.ts
50 lines (44 loc) · 1.34 KB
/
next.config.ts
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
import * as path from 'node:path';
import type { NextConfig } from 'next';
import withPigment, { type PigmentCSSConfig } from '@pigment-css/plugin/nextjs';
// @ts-expect-error This file doesn't have TS definitions.
import withDocsInfra from '@mui/monorepo/docs/nextConfigDocsInfra.js';
import theme, { THEME_DARK } from './src/theme';
import rootPackage from '../package.json';
const isProd = process.env.NODE_ENV === 'production';
const CONTENT_DIR = path.join(__dirname, 'src', 'content');
const nextConfig: NextConfig = {
pageExtensions: ['tsx', 'pigment.tsx'],
trailingSlash: false,
env: {
LIB_VERSION: rootPackage.version,
CONTENT_DIR,
CHANGELOG_FILE: path.join(__dirname, '../CHANGELOG.md'),
},
...(isProd && { distDir: 'export', output: 'export' }),
experimental: {
esmExternals: true,
workerThreads: false,
useLightningcss: true,
},
};
const pigmentConfig: PigmentCSSConfig = {
theme: {
colorSchemes: {
light: theme,
dark: THEME_DARK,
},
defaultScheme: 'light',
getSelector(mode) {
if (mode === 'light') {
return ':root, [data-theme="light"]';
}
return `[data-theme="${mode}"]`;
},
},
transformSx: false,
displayName: !isProd,
sourceMap: !isProd,
include: /\.pigment\.tsx?$/,
};
export default withPigment(withDocsInfra(nextConfig), pigmentConfig);