-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathnext.config.js
More file actions
113 lines (107 loc) · 3.58 KB
/
Copy pathnext.config.js
File metadata and controls
113 lines (107 loc) · 3.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const contentSecurityPolicy = [
"default-src 'self'",
"base-uri 'self'",
"object-src 'none'",
"frame-ancestors 'self'",
"form-action 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com https://www.gstatic.com https://apis.google.com",
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
"font-src 'self' data: https://fonts.gstatic.com",
"img-src 'self' data: blob: https://res.cloudinary.com https://firebasestorage.googleapis.com https://*.googleusercontent.com https://www.gstatic.com https://purecatamphetamine.github.io",
"connect-src 'self' https://*.googleapis.com https://*.firebaseio.com wss://*.firebaseio.com https://*.firebaseapp.com https://apis.google.com https://accounts.google.com https://cdn.jsdelivr.net https://www.google.com",
"frame-src 'self' https://www.google.com https://*.firebaseapp.com https://accounts.google.com https://apis.google.com https://www.youtube.com https://maps.google.com",
"worker-src 'self' blob:",
].join("; ");
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
images: {
unoptimized: true,
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048],
minimumCacheTTL: 60,
remotePatterns: [
{
protocol: "https",
hostname: "res.cloudinary.com",
},
],
domains: [
"firebasestorage.googleapis.com",
"res.cloudinary.com"
],
},
experimental: {
turbo: {
rules: {
'*.svg': ['@svgr/webpack'],
},
},
},
async headers() {
return [
{
source: '/:path*',
headers: [
{ key: 'Strict-Transport-Security', value: "max-age=63072000" },
{ key: 'Content-Security-Policy', value: contentSecurityPolicy },
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
{ key: 'Access-Control-Allow-Origin', value: process.env.NEXT_PUBLIC_DOMAIN },
{ key: 'Access-Control-Allow-Credentials', value: 'true' },
{ key: 'Access-Control-Allow-Methods', value: "GET,POST,PUT,PATCH,DELETE,OPTIONS" },
{
key: 'Access-Control-Allow-Headers', value: 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, Authorization'
},
{ key: 'Access-Control-Max-Age', value: '86400' },
{ key: 'Vary', value: 'Origin' },
],
},
];
},
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
];
},
skipTrailingSlashRedirect: true,
compress: true,
poweredByHeader: false,
reactStrictMode: true,
swcMinify: true,
webpack: (config) => {
const fileLoaderRule = {
test: /\.(mp4|webm|ogg|swf|ogv)$/,
use: {
loader: 'file-loader',
options: {
publicPath: '/_next/static/videos/',
outputPath: 'static/videos/',
name: '[name].[hash].[ext]',
esModule: false,
},
},
}
if (config.module?.rules) {
config.module.rules.push(fileLoaderRule)
}
// face-api.js (landing GridScan) references Node-only modules; stub them
// out of the browser bundle.
config.resolve = config.resolve || {}
config.resolve.fallback = {
...(config.resolve.fallback || {}),
fs: false,
encoding: false,
}
return config
},
}
module.exports = nextConfig