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.
46 lines
1.1 KiB
46 lines
1.1 KiB
/* eslint-disable import/no-extraneous-dependencies */ |
|
import { defineConfig, loadEnv } from 'vite'; |
|
import path from 'path'; |
|
import vue from '@vitejs/plugin-vue'; |
|
import legacy from '@vitejs/plugin-legacy'; |
|
import vueI18n from '@intlify/vite-plugin-vue-i18n'; |
|
|
|
export default defineConfig(({ mode }) => { |
|
// 加载 .env 文件 |
|
const env = loadEnv(mode, process.cwd()); |
|
return { |
|
base: env.VITE_PUBLIC_PATH, |
|
resolve: { |
|
alias: { |
|
'@/': `${path.resolve(__dirname, 'src')}/`, |
|
}, |
|
}, |
|
server: { |
|
host: '0.0.0.0', |
|
port: Number(env.VITE_PORT), |
|
proxy: { |
|
[env.VITE_BASE_API]: { |
|
target: env.VITE_PROXY, |
|
changeOrigin: true, |
|
}, |
|
'/uploads': { |
|
target: env.VITE_PROXY, |
|
changeOrigin: true, |
|
}, |
|
}, |
|
}, |
|
build: { |
|
chunkSizeWarningLimit: 1500, |
|
productionSourceMap: false, |
|
}, |
|
plugins: [ |
|
vue(), |
|
legacy({ |
|
targets: ['defaults', 'not IE 11'], |
|
}), |
|
vueI18n({ |
|
include: path.resolve(__dirname, './src/locales/**'), |
|
}), |
|
], |
|
}; |
|
});
|
|
|