-
Notifications
You must be signed in to change notification settings - Fork 4
/
next.config.js
103 lines (96 loc) · 2.65 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
/** @type {import('next').NextConfig} */
const withLess = require("next-with-less");
const withImages = require("next-images");
const path = require("path");
const pjson = require("./package.json");
const isDev = process.env.NODE_ENV !== "production";
const nextConfig = {
reactStrictMode: false,
jsconfigPaths: true,
output: "standalone",
api: {
bodyParser: {
sizeLimit: "2mb", // Set desired value here
},
},
images: {
domains: ["mtbird-cdn.staringos.com"],
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
if (!config.externals) {
config.externals = {};
}
config.externals.react = "react";
if (!config.resolve.alias) {
config.resolve.alias = {};
}
// path
config.resolve.alias["react"] = path.resolve(
__dirname,
"./node_modules/react"
);
config.resolve.alias["react-dom"] = path.resolve(
__dirname,
"./node_modules/react-dom"
);
config.resolve.alias["antd"] = path.resolve(
__dirname,
"./node_modules/antd"
);
config.resolve.alias["@mtbird/shared"] = path.resolve(
__dirname,
"./node_modules/@mtbird/shared"
);
config.resolve.alias["@mtbird/renderer-web"] = path.resolve(
__dirname,
"./node_modules/@mtbird/renderer-web"
);
config.resolve.alias["@mtbird/component-basic"] = path.resolve(
__dirname,
"./node_modules/@mtbird/component-basic"
);
config.resolve.alias["@mtbird/core"] = path.resolve(
__dirname,
"./node_modules/@mtbird/core"
);
config.resolve.alias["@mtbird/helper-component"] = path.resolve(
__dirname,
"./node_modules/@mtbird/helper-component"
);
config.resolve.alias["@mtbird/helper-extension"] = path.resolve(
__dirname,
"./node_modules/@mtbird/helper-extension"
);
config.resolve.alias["@mtbird/ui"] = path.resolve(
__dirname,
"./node_modules/@mtbird/ui"
);
return config;
},
// async redirects() {
// if (process.env.NEXT_PUBLIC_IS_INSTALL != "true") {
// return [
// {
// source: '/((?!install|api\/installer).*)',
// destination: '/install', // 重定向到 /xxx
// permanent: false, // 选择 302 临时重定向
// },
// ];
// }
// return []
// },
async rewrites() {
const router = [
{
source: "/api/ai/:path*",
destination: "https://staringai.com/api/:path*",
},
{
source: "/api/sp/:path*",
destination: "https://msp.apis.staringos.com/:path*",
},
];
return router;
},
};
module.exports = withImages(withLess(nextConfig));