You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.6 KiB
81 lines
2.6 KiB
import { defineConfig, loadEnv } from 'vite'; |
|
import createVitePlugins from './vite/plugins'; |
|
|
|
const { resolve } = require('path'); |
|
// https://vitejs.dev/config/ |
|
export default ({ mode, command }) => { |
|
const env = loadEnv(mode, process.cwd()); |
|
const { VITE_APP_BASE } = env; |
|
return defineConfig({ |
|
base: VITE_APP_BASE, |
|
server: { |
|
port: 2888, |
|
proxy: { |
|
'/api': { |
|
// target: 'http://192.168.10.126:8889', |
|
// hy |
|
// target: 'http://192.168.3.12:13000', |
|
// longge |
|
// target: 'http://192.168.3.16:13000', |
|
// xiaohei |
|
// target:'http://192.168.3.65:13000' , |
|
// target: 'http://192.168.3.65:13000', |
|
// lmy |
|
// target: 'http://192.168.10.123:8889', |
|
// cg |
|
// target: 'http://192.168.3.73:13000', |
|
// cg |
|
// target: 'http://192.168.3.2:13000', |
|
// target: 'http://192.168.10.101:8888', |
|
// 老zyc |
|
// target: 'http://192.168.10.75:8777', |
|
// 新zyc |
|
// target: 'http://192.168.6.116:8777', |
|
// target: 'http://192.168.6.122:8777', |
|
// target: 'http://192.168.3.14:13000', |
|
// target: 'http://192.168.10.25:2888', |
|
// target: 'http://192.168.6.161:9777',//CY |
|
// target: 'http://192.168.10.57:13000', |
|
// target: 'http://192.168.10.200:13000', |
|
// target: 'http://192.168.3.16:13000', |
|
// target: 'http://192.168.3.73:13000', // |
|
// target: 'http://api.huo5u.com/', |
|
target: 'http://test.api.huo5u.com', |
|
changeOrigin: true, |
|
rewrite: path => path.replace(/^\/api/, ''), |
|
}, |
|
'/imgapi': { |
|
target: 'http://127.0.0.1:38088', |
|
changeOrigin: true, |
|
rewrite: path => path.replace(/^\/imgapi/, ''), |
|
}, |
|
}, |
|
}, |
|
esbuild:{ |
|
drop: ['console','debugger'] |
|
}, |
|
resolve: { |
|
alias: { |
|
'~': resolve(__dirname, './'), |
|
'@': resolve(__dirname, './src'), |
|
components: resolve(__dirname, './src/components'), |
|
styles: resolve(__dirname, './src/styles'), |
|
utils: resolve(__dirname, './src/utils'), |
|
}, |
|
}, |
|
plugins: createVitePlugins(env, command === 'build'), |
|
build: { |
|
chunkSizeWarningLimit: 1000, |
|
rollupOptions: { |
|
output: { |
|
// 分包 |
|
manualChunks(id) { |
|
if (id.includes('node_modules')) { |
|
return id.toString().split('node_modules/')[1].split('/')[0].toString(); |
|
} |
|
}, |
|
}, |
|
}, |
|
}, |
|
}); |
|
};
|
|
|