Last active 1711432304

next.config.js Raw
1/**
2 * NEXT.JS CONFIGURATION FILE
3 * ==========================
4 */
5
6/** @type {import('next').NextConfig} */
7const 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
18const withBundleAnalyzer = require('@next/bundle-analyzer')({
19 enabled: process.env.ANALYZE === 'true' ? true : false,
20 openAnalyzer: false
21});
22
23const 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
39module.exports = nextConfig
40
41module.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