-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
36 lines (35 loc) · 1.12 KB
/
next.config.js
File metadata and controls
36 lines (35 loc) · 1.12 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
const path = require('path');
/** @type {import('next').NextConfig} */
const nextConfig = {
// keep existing setting
outputFileTracingRoot: path.join(__dirname),
// Add HTTP headers for correct WASM serving + strong caching
async headers() {
return [
// Global security headers required by some WASM decoders using SharedArrayBuffer
{
source: '/(.*)',
headers: [
{ key: 'Cross-Origin-Opener-Policy', value: 'same-origin' },
{ key: 'Cross-Origin-Embedder-Policy', value: 'require-corp' },
],
},
// Ensure .wasm is served with the correct MIME type and long cache
{
source: '/:path*.wasm',
headers: [
{ key: 'Content-Type', value: 'application/wasm' },
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
],
},
// Cache-static assets aggressively
{
source: '/:all*(js|css|png|jpg|jpeg|webp|gif|svg|ico|txt)',
headers: [
{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' },
],
},
];
},
};
module.exports = nextConfig;