-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
72 lines (69 loc) · 1.58 KB
/
next.config.mjs
File metadata and controls
72 lines (69 loc) · 1.58 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** @type {import('next').NextConfig} */
const nextConfig = {
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
},
// Enable Web Workers with Turbopack
experimental: {
turbo: {
rules: {
'*.worker.ts': {
loaders: ['worker-loader'],
as: '*.js',
},
},
},
},
// Headers for caching static assets (images, fonts, etc.)
async headers() {
return [
{
// Apply caching to static images
source: '/:all*(svg|jpg|jpeg|png|gif|ico|webp|avif)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
// Apply caching to static fonts
source: '/:all*(woff|woff2|ttf|otf|eot)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
// Apply caching to JS/CSS
source: '/_next/static/:path*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
];
},
// Webpack configuration for Web Workers and WebAssembly
webpack: (config, { isServer }) => {
if (!isServer) {
// Enable web workers
config.output.globalObject = 'self';
}
// Enable WebAssembly support for qpdf-wasm
config.experiments = {
...config.experiments,
asyncWebAssembly: true,
};
return config;
},
}
export default nextConfig