-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnext.config.mjs
59 lines (52 loc) · 1.7 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import withSerwistInit from "@serwist/next";
import nextMDX from "@next/mdx";
const withMDX = nextMDX();
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
output: "export",
images: {
loader: "custom",
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
transpilePackages: ["next-image-export-optimizer"],
env: {
nextImageExportOptimizer_imageFolderPath: "public/images",
nextImageExportOptimizer_exportFolderPath: "out",
nextImageExportOptimizer_quality: "75",
nextImageExportOptimizer_storePicturesInWEBP: "true",
nextImageExportOptimizer_exportFolderName: "nextImageExportOptimizer",
nextImageExportOptimizer_generateAndUseBlurImages: "true",
nextImageExportOptimizer_remoteImageCacheTTL: "0",
},
webpack: (config) => {
config.module.rules.push({
test: /\.wasm$/,
type: "asset/resource",
generator: {
filename: "static/chunks/[name].[hash][ext]",
},
});
// https://ocjs.org/docs/app-dev-workflow/pre-built
config.module.rules.push({
test: /\.wasm$/,
type: "javascript/auto",
loader: "file-loader",
options: {
name: "static/chunks/[name].[hash].[ext]",
},
});
config.resolve.fallback = { fs: false };
config.experiments = { ...config.experiments, asyncWebAssembly: true };
return config;
},
};
const withSerwist = withSerwistInit({
swSrc: "app/sw.ts",
swDest: "public/sw.js",
reloadOnOnline: false,
maximumFileSizeToCacheInBytes: 15000000,
include: [/^(?!.*\/icons\/(android|ios)\/).*/],
});
export default withSerwist(withMDX(nextConfig));