| | |
| | | import { |
| | | defineConfig, |
| | | loadEnv |
| | | } from 'vite'; |
| | | import { resolve } from 'path' |
| | | import { defineConfig, loadEnv } from 'vite'; |
| | | import { resolve } from 'path'; |
| | | import createVitePlugins from './vite/plugins'; |
| | | // https://vitejs.dev/config/ |
| | | export default ({ |
| | | mode, |
| | | command |
| | | }) => { |
| | | const env = loadEnv(mode, process.cwd()) |
| | | const { |
| | | VITE_APP_ENV, |
| | | VITE_APP_BASE |
| | | } = env |
| | | export default ({ mode, command }) => { |
| | | const env = loadEnv(mode, process.cwd()); |
| | | const { VITE_APP_ENV, VITE_APP_BASE } = env; |
| | | // 判断是打生产环境包 |
| | | const isProd = VITE_APP_ENV === 'production' |
| | | const isProd = VITE_APP_ENV === 'production'; |
| | | |
| | | // 根据是否生产环境,动态设置压缩配置 |
| | | const buildConfig = { |
| | |
| | | drop_debugger: true, // 删除 debugger |
| | | }, |
| | | format: { |
| | | comments: false // 删除所有注释 |
| | | } |
| | | comments: false, // 删除所有注释 |
| | | }, |
| | | }; |
| | | } |
| | | return defineConfig({ |
| | |
| | | define: { |
| | | __VUE_I18N_FULL_INSTALL__: true, |
| | | __VUE_I18N_LEGACY_API__: true, |
| | | __INTLIFY_PROD_DEVTOOLS__: false |
| | | __INTLIFY_PROD_DEVTOOLS__: false, |
| | | }, |
| | | server: { |
| | | port: 2888, |
| | | proxy: { |
| | | '/api': { |
| | | target: 'http://localhost', |
| | | // target: 'https://wrj.shuixiongit.com/api', |
| | | // target: 'http://localhost', |
| | | target: 'https://wrj.shuixiongit.com/api', |
| | | changeOrigin: true, |
| | | rewrite: path => path.replace(/^\/api/, ''), |
| | | }, |