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