-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
49 lines (40 loc) · 1.43 KB
/
next.config.mjs
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
import packageInfo from "./package.json" assert { type: "json" };
function formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}`;
}
const isProduction = process.env.NODE_ENV === "production";
/** @type {import('next').NextConfig} */
const nextConfig = {
output: isProduction ? "export" : undefined,
basePath: isProduction ? "/s-wave" : undefined,
assetPrefix: isProduction ? "/s-wave" : undefined,
transpilePackages: ["lucide-react"],
images: {
unoptimized: isProduction ? true : undefined,
},
// Override the default webpack configuration
webpack: (config) => {
// See https://webpack.js.org/configuration/resolve/#resolvealias
// See https://github.com/xenova/transformers.js/issues/440
config.resolve.alias = {
...config.resolve.alias,
sharp$: false,
"onnxruntime-node$": false,
};
return config;
},
env: {
BUILD_TIME: formatDate(new Date()),
VERSION: packageInfo.version,
},
// Indicate that these packages should not be bundled by webpack
experimental: {
serverComponentsExternalPackages: ["sharp", "onnxruntime-node"],
},
};
export default nextConfig;