-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
48 lines (39 loc) · 1.02 KB
/
next.config.ts
File metadata and controls
48 lines (39 loc) · 1.02 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
import type { NextConfig } from 'next';
import withBundleAnalyzer from '@next/bundle-analyzer';
import createNextIntlPlugin from 'next-intl/plugin';
const imageCacheTimeOut = 60 * 60 * 24 * 7;
const withNextIntl = createNextIntlPlugin();
const nextConfig: NextConfig = {
/* config options here */
// output: 'export',
compress: true,
// 高速CDN缓存时间
expireTime: imageCacheTimeOut,
experimental: {
optimizePackageImports: ['react', 'react-dom', 'swiper', 'framer-motion'],
optimizeCss: true,
},
httpAgentOptions: {
keepAlive: false,
},
onDemandEntries: {
pagesBufferLength: 5,
},
reactStrictMode: false,
images: {
minimumCacheTTL: imageCacheTimeOut,
formats: ['image/avif', 'image/webp'],
},
sassOptions: {},
webpack: (config, { isServer }) => {
if (!isServer) {
config.externals = {
...config.externals,
};
}
return config;
},
};
export default withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})(withNextIntl(nextConfig));