forked from subscan-explorer/subscan-essentials-ui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
42 lines (36 loc) · 1.57 KB
/
Copy pathnext.config.js
File metadata and controls
42 lines (36 loc) · 1.57 KB
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
/** @type {import('next').NextConfig} */
const childProcess = require('child_process')
const { configureRuntimeEnv } = require('next-runtime-env/build/configure')
configureRuntimeEnv()
const readGitValue = (command) => {
try {
return childProcess.execSync(command, { encoding: 'utf8' }).trim()
} catch {
return ''
}
}
const buildCommitSha = process.env.VERCEL_GIT_COMMIT_SHA || process.env.GITHUB_SHA || readGitValue('git rev-parse HEAD') || 'unknown'
const buildCommitRef =
process.env.VERCEL_GIT_COMMIT_REF || process.env.GITHUB_REF_NAME || readGitValue('git rev-parse --abbrev-ref HEAD') || 'unknown'
const buildRepoOwner = process.env.VERCEL_GIT_REPO_OWNER || 'litentry'
const buildRepoSlug = process.env.VERCEL_GIT_REPO_SLUG || 'subscan-essentials-ui-react'
const buildDeploymentUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : ''
const buildCommitUrl = buildCommitSha === 'unknown' ? '' : `https://github.com/${buildRepoOwner}/${buildRepoSlug}/commit/${buildCommitSha}`
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const nextConfig = {
output: 'standalone',
env: {
NEXT_PUBLIC_BUILD_COMMIT_SHA: buildCommitSha,
NEXT_PUBLIC_BUILD_COMMIT_REF: buildCommitRef,
NEXT_PUBLIC_BUILD_COMMIT_URL: buildCommitUrl,
NEXT_PUBLIC_BUILD_DEPLOYMENT_URL: buildDeploymentUrl,
NEXT_PUBLIC_BUILD_REPOSITORY: `${buildRepoOwner}/${buildRepoSlug}`,
NEXT_PUBLIC_BUILD_TIME: new Date().toISOString(),
},
async rewrites() {
return []
},
}
module.exports = withBundleAnalyzer(nextConfig)