-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathnext.config.ts
More file actions
50 lines (45 loc) · 1.32 KB
/
Copy pathnext.config.ts
File metadata and controls
50 lines (45 loc) · 1.32 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
49
50
import type { NextConfig } from 'next';
import withPWAInit from '@ducanh2912/next-pwa';
// When running Playwright E2E tests, the dev server must not use
// `output: 'export'` because static export mode is incompatible with
// middleware and the `npm run dev` server that Playwright spins up.
const isE2E = process.env.E2E_TEST === 'true';
const withPWA = withPWAInit({
dest: 'public',
disable: process.env.NODE_ENV === 'development',
register: true,
reloadOnOnline: true,
cacheOnFrontEndNav: true,
extendDefaultRuntimeCaching: true,
workboxOptions: {
runtimeCaching: [
{
urlPattern: ({ url }) => url.pathname.startsWith('/api/'),
handler: 'NetworkFirst',
options: {
cacheName: 'apis',
expiration: {
maxEntries: 16,
maxAgeSeconds: 24 * 60 * 60,
},
networkTimeoutSeconds: 10,
},
},
],
},
});
const nextConfig: NextConfig = {
/* config options here */
...(isE2E ? {} : { output: 'export' }),
devIndicators: {
// @ts-ignore - buildActivity is valid but missing in type definition
buildActivity: false,
// @ts-ignore - appIsrStatus is valid but missing in type definition
appIsrStatus: false,
},
reactCompiler: false,
images: {
unoptimized: true,
},
};
export default withPWA(nextConfig);