Skip to content

Commit dbfa63f

Browse files
authored
🔨 chore: improve next config (lobehub#2044)
1 parent ea51c3a commit dbfa63f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

next.config.mjs

+15-13
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ const API_PROXY_ENDPOINT = process.env.API_PROXY_ENDPOINT || '';
99

1010
const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
1111

12-
const withBundleAnalyzer = analyzer({
13-
enabled: process.env.ANALYZE === 'true',
14-
});
15-
16-
const withPWA = nextPWA({
17-
dest: 'public',
18-
register: true,
19-
workboxOptions: {
20-
skipWaiting: true,
21-
},
22-
});
23-
2412
/** @type {import('next').NextConfig} */
2513
const nextConfig = {
2614
compress: isProd,
@@ -67,4 +55,18 @@ const nextConfig = {
6755
},
6856
};
6957

70-
export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig;
58+
const noWrapper = (config) => config;
59+
60+
const withBundleAnalyzer = process.env.ANALYZE === 'true' ? analyzer() : noWrapper;
61+
62+
const withPWA = isProd
63+
? nextPWA({
64+
dest: 'public',
65+
register: true,
66+
workboxOptions: {
67+
skipWaiting: true,
68+
},
69+
})
70+
: noWrapper;
71+
72+
export default withBundleAnalyzer(withPWA(nextConfig));

0 commit comments

Comments
 (0)