next.config.js
· 2.0 KiB · JavaScript
Raw
/**
* NEXT.JS CONFIGURATION FILE
* ==========================
*/
/** @type {import('next').NextConfig} */
const withPWA = require("@ducanh2912/next-pwa").default({
register: true,
dest: "public",
reloadOnOnline: true,
cacheOnFrontEndNav: true,
swcMinify: true,
compress: true,
optimizeFonts: true,
disable: process.env.NODE_ENV == "development",
});
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true' ? true : false,
openAnalyzer: false
});
const nextConfig = {
async headers() {
return [
{
source: "https://api.topiclist.xyz/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET,DELETE,PATCH,POST,PUT" },
{ 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" },
]
}
]
}
}
module.exports = nextConfig
module.exports = withBundleAnalyzer(
withPWA({
images: {
formats: ["image/avif", "image/webp"],
dangerouslyAllowSVG: true,
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "cdn.topiclist.xyz",
},
{
protocol: "https",
hostname: "beta.cordx.lol",
},
],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 100, 128, 150, 256, 384],
},
env: {
apiUrl: process.env.apiUrl,
apiUrl_priv: process.env.apiUrl_priv,
appUrl: process.env.appUrl,
jwtSecret: process.env.jwtSecret,
},
})
);
1 | /** |
2 | * NEXT.JS CONFIGURATION FILE |
3 | * ========================== |
4 | */ |
5 | |
6 | /** @type {import('next').NextConfig} */ |
7 | const withPWA = require("@ducanh2912/next-pwa").default({ |
8 | register: true, |
9 | dest: "public", |
10 | reloadOnOnline: true, |
11 | cacheOnFrontEndNav: true, |
12 | swcMinify: true, |
13 | compress: true, |
14 | optimizeFonts: true, |
15 | disable: process.env.NODE_ENV == "development", |
16 | }); |
17 | |
18 | const withBundleAnalyzer = require('@next/bundle-analyzer')({ |
19 | enabled: process.env.ANALYZE === 'true' ? true : false, |
20 | openAnalyzer: false |
21 | }); |
22 | |
23 | const nextConfig = { |
24 | async headers() { |
25 | return [ |
26 | { |
27 | source: "https://api.topiclist.xyz/:path*", |
28 | headers: [ |
29 | { key: "Access-Control-Allow-Credentials", value: "true" }, |
30 | { key: "Access-Control-Allow-Origin", value: "*" }, |
31 | { key: "Access-Control-Allow-Methods", value: "GET,DELETE,PATCH,POST,PUT" }, |
32 | { 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" }, |
33 | ] |
34 | } |
35 | ] |
36 | } |
37 | } |
38 | |
39 | module.exports = nextConfig |
40 | |
41 | module.exports = withBundleAnalyzer( |
42 | withPWA({ |
43 | images: { |
44 | formats: ["image/avif", "image/webp"], |
45 | dangerouslyAllowSVG: true, |
46 | unoptimized: true, |
47 | remotePatterns: [ |
48 | { |
49 | protocol: "https", |
50 | hostname: "cdn.topiclist.xyz", |
51 | }, |
52 | { |
53 | protocol: "https", |
54 | hostname: "beta.cordx.lol", |
55 | }, |
56 | ], |
57 | deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], |
58 | imageSizes: [16, 32, 48, 64, 96, 100, 128, 150, 256, 384], |
59 | }, |
60 | env: { |
61 | apiUrl: process.env.apiUrl, |
62 | apiUrl_priv: process.env.apiUrl_priv, |
63 | appUrl: process.env.appUrl, |
64 | jwtSecret: process.env.jwtSecret, |
65 | }, |
66 | }) |
67 | ); |
68 |