-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextjs.config.ts
52 lines (46 loc) · 1.28 KB
/
nextjs.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
51
52
import type { NextConfig } from 'next'
import type { Configuration as WebpackConfig } from 'webpack'
const nextConfig: NextConfig = {
webpack: (config: WebpackConfig, { isServer, dev }): WebpackConfig => {
const optimization = config.optimization || {}
const splitChunks = optimization.splitChunks || {}
const cacheGroups = (splitChunks as any).cacheGroups || {}
config.optimization = {
...optimization,
moduleIds: 'deterministic',
splitChunks: {
...splitChunks,
chunks: 'all',
cacheGroups: {
...cacheGroups,
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
maxSize: 150000,
},
},
},
}
const fallback = config.resolve?.fallback || {}
config.resolve = {
...config.resolve,
fallback: {
...fallback,
Buffer: require.resolve('buffer/'),
},
}
if (dev) {
config.cache = {
type: 'filesystem',
compression: 'brotli',
maxGenerations: 1,
} as WebpackConfig['cache']
}
return config
},
experimental: {
optimizePackageImports: ['@reown/appkit', '@walletconnect/universal-provider'],
},
}
export default nextConfig