-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
43 lines (37 loc) · 947 Bytes
/
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
// @ts-check
import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from "next/constants.js";
/**
* @param {string} phase
* @param {object} obj
* @param {import('next').NextConfig} obj.defaultConfig
*/
const nextConfig = async (phase, { defaultConfig }) => {
const basePath = process.env.BASE_PATH || "";
/** @type {import('next').NextConfig} */
const sharedConfig = {
...defaultConfig,
basePath,
env: {
BASE_PATH: basePath,
},
output: "export",
trailingSlash: true,
};
switch (phase) {
case PHASE_PRODUCTION_BUILD:
/** @type {import('next').NextConfig} */
const prodConfig = {
...sharedConfig,
unoptimized: true,
};
return prodConfig;
case PHASE_DEVELOPMENT_SERVER:
default:
/** @type {import('next').NextConfig} */
const devConfig = {
...sharedConfig,
};
return devConfig;
}
}
export default nextConfig;