frequi_origin/vite.config.ts

81 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-10-30 10:01:27 +00:00
import createVuePlugin from '@vitejs/plugin-vue';
2024-07-03 17:44:48 +00:00
import { BootstrapVueNextResolver } from 'bootstrap-vue-next';
import { execSync } from 'child_process';
2021-11-14 10:50:33 +00:00
import { resolve } from 'path';
2024-07-03 17:44:48 +00:00
import AutoImport from 'unplugin-auto-import/vite';
import IconsResolve from 'unplugin-icons/resolver';
2023-05-08 19:18:47 +00:00
import Icons from 'unplugin-icons/vite';
2023-05-09 16:14:20 +00:00
import Components from 'unplugin-vue-components/vite';
2024-07-03 17:44:48 +00:00
import { defineConfig } from 'vite';
2024-03-10 19:29:40 +00:00
let commitHash: string = 'unknown';
try {
commitHash = execSync('git rev-parse --short HEAD').toString();
} catch (error) {
console.error('Failed to get commit hash. Running in this mode will not be supported.');
}
2021-05-24 13:25:48 +00:00
// https://vitejs.dev/config/
export default defineConfig({
2024-03-10 19:29:40 +00:00
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
2023-05-08 19:18:47 +00:00
plugins: [
2023-05-28 15:25:15 +00:00
createVuePlugin({
script: {
defineModel: true,
},
}),
2023-05-09 16:14:20 +00:00
Components({
resolvers: [IconsResolve(), BootstrapVueNextResolver()],
dts: 'src/components.d.ts',
2023-05-09 16:14:20 +00:00
}),
2023-05-08 19:18:47 +00:00
Icons({
compiler: 'vue3',
}),
2023-11-14 05:29:28 +00:00
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
2023-11-14 05:29:28 +00:00
dts: 'src/auto-imports.d.ts',
2024-07-05 12:27:43 +00:00
dirs: ['src/composables', 'src/stores', 'src/utils/**'],
2023-11-14 05:29:28 +00:00
vueTemplate: true,
}),
2023-05-08 19:18:47 +00:00
],
2021-05-24 13:25:48 +00:00
resolve: {
2022-11-18 16:08:49 +00:00
dedupe: ['vue'],
2022-10-30 10:01:27 +00:00
alias: {
'@': resolve(__dirname, 'src'),
},
2021-05-24 13:25:48 +00:00
},
build: {
chunkSizeWarningLimit: 700, // Default is 500
2022-02-05 19:13:18 +00:00
sourcemap: true,
2021-05-24 13:25:48 +00:00
},
css: {
preprocessorOptions: {
scss: {
2021-11-14 10:50:33 +00:00
additionalData: '@import "@/styles/_variables.scss";',
},
},
},
2022-02-05 19:13:18 +00:00
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
},
},
host: '127.0.0.1',
2023-04-11 04:52:17 +00:00
port: 3000,
2022-02-05 19:13:18 +00:00
},
2024-04-08 05:02:07 +00:00
test: {
2024-04-12 18:10:01 +00:00
environment: 'happy-dom',
2024-04-08 05:02:07 +00:00
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/e2e/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
],
},
2021-05-24 13:25:48 +00:00
});