2023-03-07 06:19:05 +00:00
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
2023-06-13 16:08:43 +00:00
|
|
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
|
|
|
import { dirname, resolve } from 'node:path'
|
2023-08-18 18:21:31 +00:00
|
|
|
import { gitDescribeSync } from 'git-describe'
|
|
|
|
|
|
|
|
// Footer version
|
|
|
|
const gitVer = gitDescribeSync()
|
|
|
|
process.env.SAFETWITCH_COMMIT_HASH = gitVer.hash
|
|
|
|
process.env.SAFETWITCH_TAG = gitVer.tag!
|
|
|
|
|
2023-03-07 06:19:05 +00:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2023-06-13 16:08:43 +00:00
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
VueI18nPlugin({
|
|
|
|
include: resolve(dirname(fileURLToPath(import.meta.url)), './src/locales/**'),
|
|
|
|
})
|
|
|
|
],
|
2023-03-07 06:19:05 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
2023-03-19 23:52:28 +00:00
|
|
|
},
|
|
|
|
build: {
|
2023-10-05 00:06:55 +00:00
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
manualChunks(id) {
|
|
|
|
if (id.includes('node_modules')) {
|
|
|
|
return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-09-10 19:21:55 +00:00
|
|
|
},
|
2023-06-13 16:08:43 +00:00
|
|
|
envPrefix: 'SAFETWITCH_',
|
2023-03-07 06:19:05 +00:00
|
|
|
})
|
2023-08-18 18:21:31 +00:00
|
|
|
|