fix: footer date in edgeone without cloudflare env

This commit is contained in:
YunYouJun
2025-08-17 03:28:50 +08:00
parent 13b6ad6047
commit 6095d97b2a
7 changed files with 56 additions and 18 deletions

View File

@@ -2,14 +2,22 @@ import process from 'node:process'
import { pwa } from './app/config/pwa'
import { appDescription } from './app/constants/index'
Object.assign(process.env, {
VITE_COMMIT_REF: process.env.CF_PAGES_COMMIT_SHA || '',
})
// for cloudflare
// Object.assign(process.env, {
// VITE_COMMIT_REF: process.env.CF_PAGES_COMMIT_SHA || '',
// })
import { getLatestCommit } from './scripts/git'
const latestCommit = await getLatestCommit()
/**
* CF_PAGES_COMMIT_SHA is Cloudflare Pages env
*/
import.meta.env.VITE_COMMIT_REF = process.env.CF_PAGES_COMMIT_SHA || latestCommit?.hash || ''
// add build date string to env
import.meta.env.VITE_APP_BUILD_DATE = latestCommit?.date || new Date().toString()
// add build time to env
import.meta.env.VITE_APP_BUILD_TIME = new Date().getTime().toString()
export default defineNuxtConfig({
modules: [
'@vueuse/nuxt',
'@unocss/nuxt',