123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import { defineConfig,loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import legacy from '@vitejs/plugin-legacy'
- import path from 'path'
- // https://vitejs.dev/config/
- export default defineConfig(({mode})=>{
- const ENV = loadEnv(mode, process.cwd());
- return {
- base:ENV.VITE_APP_BASE_URL, // 若服务器不是将该项目放在根目录的则 需要此设置 和服务器上同名
- plugins: [
- vue(),
- legacy({
- polyfills: ['es.promise.finally', 'es/map', 'es/set'],
- modernPolyfills: ['es.promise.finally']
- })
- ],
- server: {
- port: 3000,
- cors: true,
- host: '0.0.0.0',
- proxy: {
- '/v1': {
- // target: 'http://8.136.199.33:8608',
- target: 'https://charttest.hzinsights.com',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/v1/, '/v1')
- }
- },
- },
- build: {
- outDir: 'eta_chart_front',
- chunkSizeWarningLimit: 1000,//单文件过1000kb警告
- },
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src')
- },
- },
- css: {
- postcss: {
- plugins: [
- {
- postcssPlugin: 'internal:charset-removal',
- AtRule: {
- charset: (atRule) => {
- if (atRule.name === 'charset') {
- atRule.remove()
- }
- }
- }
- }
- ]
- }
- }
- }
- })
|