feat: post build script for opengraph

This commit is contained in:
2026-04-25 20:45:20 +02:00
parent 9162c149c4
commit 7885d22194
8 changed files with 124 additions and 21 deletions
+23 -14
View File
@@ -1,21 +1,30 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import { plugin as mdPlugin, Mode } from 'vite-plugin-markdown'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@views': fileURLToPath(new URL('./src/views', import.meta.url)),
'@lib': fileURLToPath(new URL('./src/lib', import.meta.url)),
'@articles': fileURLToPath(new URL('./articles', import.meta.url)),
'@interfaces': fileURLToPath(new URL('./src/interfaces.ts', import.meta.url)),
'@components': fileURLToPath(new URL('./src/components', import.meta.url)),
export default ({ mode }: { mode: string }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
process.env.VITE_APP_TITLE_NO_HTML = process.env.VITE_APP_TITLE?.replace(
/(<([^>]+)>)/gi,
'',
).trim()
return defineConfig({
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
base: process.env.VITE_BASE_URL,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@views': fileURLToPath(new URL('./src/views', import.meta.url)),
'@lib': fileURLToPath(new URL('./src/lib', import.meta.url)),
'@articles': fileURLToPath(new URL('./articles', import.meta.url)),
'@interfaces': fileURLToPath(new URL('./src/interfaces.ts', import.meta.url)),
'@components': fileURLToPath(new URL('./src/components', import.meta.url)),
},
},
},
})
})
}