freeleaps_frontend/frontend/vite.config.js
2024-06-07 09:01:48 +08:00

60 lines
1.3 KiB
JavaScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import vue from '@vitejs/plugin-vue'
const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir);
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
createSvgIconsPlugin({
iconDirs: [resolve('src/icons')],
symbolId: 'icon-[name]'
}),
],
resolve: {
root: resolve('src'),
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~bootstrap': resolve('node_modules/bootstrap'),
'~quill': resolve('node_modules/quill'),
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/assets/styles/main.scss";`
},
styl: {
additionalData: ` @import '~quill/dist/quill.core.css';'~quill/dist/quill.bubble.css';'~quill/dist/quill.snow.css';`
}
}
},
server: {
proxy: {
'^/api/': {
target: 'https://freeleaps-alpha.com',
ws: true,
changeOrigin: true
}
}
},
optimizeDeps: {
esbuildOptions: {
supported: {
"top-level-await": true
},
},
},
esbuild: {
supported: {
'top-level-await': true //browsers can handle top-level-await features
},
}
})