-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
next.config.mjs
37 lines (31 loc) · 919 Bytes
/
next.config.mjs
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
// @ts-check
import withSerwistInit from '@serwist/next';
import million from 'million/compiler';
import withLitSSR from '@lit-labs/nextjs';
import withBundleAnalyzer from '@next/bundle-analyzer';
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compress: true,
};
const withSerwist = withSerwistInit({
swSrc: './src/app/sw.ts',
swDest: 'public/sw.js',
cacheOnNavigation: true,
disable: process.env.NODE_ENV === 'development',
scope: '/',
register: true,
reloadOnOnline: true,
maximumFileSizeToCacheInBytes: 3000000,
});
const millionConfig = {
auto: true, // if you're using RSC: auto: { rsc: true },
};
// if withLitSSR is in the withSerwist, it will not work
const config = withLitSSR(withSerwist(million.next(nextConfig, millionConfig)));
export default process.env.ANALYZE === 'true'
? withBundleAnalyzer(config)
: config;