-
Notifications
You must be signed in to change notification settings - Fork 7
/
next.config.js
39 lines (38 loc) · 1.23 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
/** @type {import('next').NextConfig} */
const nextConfig = {
publicRuntimeConfig: {
API_URL: process.env.API_URL || process.env.NUXT_PUBLIC_API_URL,
CDN_URL: process.env.CDN_URL || process.env.NUXT_PUBLIC_CDN_URL,
SHOW_SSO_LOGIN_BUTTON: process.env.SHOW_SSO_LOGIN_BUTTON,
FORCE_SSO_AUTH: process.env.FORCE_SSO_AUTH,
REQUIRE_LOGIN: process.env.REQUIRE_LOGIN,
},
reactStrictMode: true,
swcMinify: true,
output: "standalone",
typescript: {
ignoreBuildErrors: true,
},
generateBuildId: async () => {
// Get the latest commit hash from git
const { execSync } = require("child_process");
const gitHash = execSync("git rev-parse HEAD").toString().trim();
// Get the current date
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const dateString = `${year}-${month}-${day}`;
// Return the build id
return `${gitHash}-${dateString}`;
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.plugins.push(
new webpack.DefinePlugin({
"process.env.CONFIG_BUILD_ID": JSON.stringify(buildId),
})
);
return config;
},
};
module.exports = nextConfig;