-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
55 lines (47 loc) · 1.34 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const path = require('path')
const webpack = require('webpack')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
webpack: (config, { dev, isServer }) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
if (!dev && !isServer) {
// Replace React with Preact only in client production build
Object.assign(config.resolve.alias, {
'react/jsx-runtime.js': 'preact/compat/jsx-runtime',
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
})
}
if (isServer) {
require('./scripts/generate-sitemap')
}
if (!isServer) {
require('./scripts/compose')
}
config.plugins.push(
new webpack.EnvironmentPlugin(
'NEXT_PUBLIC_GISCUS_REPO',
'NEXT_PUBLIC_GISCUS_REPOSITORY_ID',
'NEXT_PUBLIC_GISCUS_CATEGORY',
'NEXT_PUBLIC_GISCUS_CATEGORY_ID',
'NEXT_PUBLIC_PLAUSIBLE_API_KEY',
),
)
return config
},
})
/** @type {import('next').NextConfig} */
const nextConfig = {
/* Configure pageExtensions to include md and mdx */
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
/* Optionally, add any other Next.js config below */
reactStrictMode: true,
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
}
module.exports = withBundleAnalyzer(nextConfig)