50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { resolve } from 'node:path'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { defineConfig } from 'vite'
|
|
|
|
const host = process.env.TAURI_DEV_HOST
|
|
|
|
export default defineConfig(async () => ({
|
|
plugins: [vue(), tailwindcss()],
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
// Inject variables/mixins into every Vue component's <style lang="scss">
|
|
additionalData: (source: string, filePath: string) => {
|
|
// Skip the variables file itself and the main style files to avoid circular deps
|
|
if (filePath.includes('_variables') || filePath.includes('styles/main') || filePath.includes('styles/tailwind')) {
|
|
return source
|
|
}
|
|
return `@use "@/styles/_variables.scss" as *;\n${source}`
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
|
clearScreen: false,
|
|
server: {
|
|
port: 3000,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host
|
|
? {
|
|
protocol: 'ws',
|
|
host,
|
|
port: 1421,
|
|
}
|
|
: undefined,
|
|
watch: {
|
|
ignored: ['**/src-tauri/**'],
|
|
},
|
|
},
|
|
}))
|