1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| import { defineConfig, loadEnv } from 'vite' import path from 'path' import createVitePlugins from './vite/plugins'
export default defineConfig(({ mode, command }) => { const env = loadEnv(mode, process.cwd()) const { VITE_APP_ENV } = env return { base: VITE_APP_ENV === 'production' ? '/' : '/', build: { outDir: '../ruoyi-ui-template', assetsDir: 'static', }, plugins: createVitePlugins(env, command === 'build'), resolve: { alias: { '~': path.resolve(__dirname, './'), '@': path.resolve(__dirname, './src') }, extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] }, server: { port: 8321, host: true, open: true, cors: false, proxy: { '/dev-api': { target: 'http://localhost:8080', changeOrigin: true, rewrite: (p) => p.replace(/^\/dev-api/, '') } } }, css: { postcss: { plugins: [ { postcssPlugin: 'internal:charset-removal', AtRule: { charset: (atRule) => { if (atRule.name === 'charset') { atRule.remove(); } } } } ] } } } })
|