-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
36 lines (29 loc) · 1.06 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
import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev'
import cp from 'node:child_process'
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const pkg = require('./package.json')
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to use bindings during local development
// (when running the application with `next dev`), for more information see:
// https://github.com/cloudflare/next-on-pages/blob/main/internal-packages/next-dev/README.md
if (process.env.NODE_ENV === 'development') {
await setupDevPlatform()
}
const shortHash8 = cp.execSync('git rev-parse --short=8 HEAD').toString().trim()
const buildDate = new Date().toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})
/** @type {import('next').NextConfig} */
const nextConfig = {
/* config options here */
env: {
NEXT_PUBLIC_BUILD_DATE: buildDate,
NEXT_PUBLIC_APP_VERSION: pkg.version + '@' + shortHash8,
},
}
export default nextConfig