This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnext.config.js
76 lines (73 loc) · 1.86 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
/** @type {import('next').NextConfig} */
const path = require("path");
const withCSS = require("@zeit/next-css");
const getRobotsPath = () => path.join(__dirname, "public", "robots.txt");
const getSitemapPath = () => path.join(__dirname, "public", "sitemap.xml");
const getDeadChainPath = () => path.join(__dirname, "public", "deadChain.xml");
const getRssPath = () => path.join(__dirname, "public", "rss.xml");
const getImagePath = (v) => path.join(__dirname, "public", "images", v);
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
presets: ["next/babel"],
plugins: [
// 其他插件...
process.env.NODE_ENV === "production" &&
"babel-plugin-transform-remove-console",
].filter(Boolean),
withCSS: withCSS(),
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**.myqcloud.com",
},
{
protocol: "https",
hostname: "img.foreverblog.cn",
},
],
},
rewrites: () => {
return [
{
source: "/sitemap.xml",
destination: "/api/sitemap",
},
{
source: "/deadChain.xml",
destination: "/api/deadChain",
},
{
source: "/rss.xml",
destination: "/api/rss",
},
{
source: "/robots.txt",
destination: getRobotsPath(),
},
{
source: "/public/sitemap.xml",
destination: getSitemapPath(),
},
{
source: "/public/deadChain.xml",
destination: getDeadChainPath(),
},
{
source: "/public/rss.xml",
destination: getRssPath(),
},
{
source: "/public/images/:path*",
destination: getImagePath(":path*"),
},
{
source: "/js/:path*",
destination:
"https://wp-1302605407.cos.ap-beijing.myqcloud.com/js/:path*",
},
];
},
};
module.exports = nextConfig;