-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
108 lines (98 loc) · 2.97 KB
/
next.config.js
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
const config = require("./src/config/config.json")
const languages = require("./src/config/language.json")
const disableLanguages = config.settings.disable_languages
const activeLanguages = languages.filter(
(lang) => !disableLanguages.includes(lang.languageCode),
)
const defaultLanguage = config.settings.default_language
const otherLanguages = activeLanguages
.map((lang) => lang.languageCode)
.filter((lang) => lang !== defaultLanguage)
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
basePath: config.base_path !== "/" ? config.base_path : "",
trailingSlash: config.site.trailing_slash,
// output: "standalone",
async rewrites() {
if (config.settings.default_language_in_subdir) {
return []
}
return activeLanguages.length !== 1
? [
{
source: `/:lang(!${defaultLanguage}|${otherLanguages.join("|")})/:path*`,
destination: `/:lang/:path*`,
},
{
source: `/:path*`,
destination: `/${defaultLanguage}/:path*`,
},
]
: [
{
source: `/${defaultLanguage}/:path*`,
destination: `/${defaultLanguage}/:path*`,
},
{
source: "/:path*",
destination: `/${defaultLanguage}/:path*`,
},
]
},
// ** CUSTOM NEXT CONFIG [MM]
// ** IMAGES (production use?)
images: {
// deprecated: use remotePatterns..
// domains: [
// // process.env.NEXT_PUBLIC_WP_GRAPHQL_API_URL.match(/(?!(w+)\.)\w*(?:\w+\.)+\w+/)[0],
// // Valid WP Image domain.
// // '0.gravatar.com',
// // '1.gravatar.com',
// // '2.gravatar.com',
// // 'secure.gravatar.com',
// // 'images.cdndomain.com',
// ],
remotePatterns: [
// {
// protocol: 'http',
// hostname: '**',
// // port: '7777',
// // pathname: '/**',
// },
{
protocol: 'https',
hostname: 'threedpublic.s3.us-west-2.amazonaws.com',
port: '',
pathname: '**',
},
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
port: '',
pathname: '**'
},
],
// // loader: 'default',
// // // path: 'https://somedomain.com/mydirectory/',
// // // deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
// // // imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
// formats: ['image/avif', 'image/webp'],
// // // minimumCacheTTL: 60,
// disableStaticImages: true, // for avif image files to work properly
// // dangerouslyAllowSVG: true,
// // contentSecurityPolicy: 'default-src 'self'; script-src 'none'; sandbox;',
},
// ** WEBPACK [MM]
webpack(config, { isServer }) {
// glb + gltf support
config.module.rules.push({
test: /\.(glb|gltf)$/,
// include: [/public/],
exclude: /node_modules/,
type: 'asset/resource',
})
return config
},
}
module.exports = nextConfig