IM/frontend/web/vite.config.js

35 lines
631 B
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig(( { command } ) => {
let branch = process.env.BRANCH || 'main'
// 1⃣ dev 模式:永远 /
if (command === 'serve') {
branch = '/'
}else{
branch = `/${branch}/`
}
return {
base: branch,
build: {
sourcemap: true
},
plugins: [
vue(),
vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
}
})