123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // https://vite.dev/config/
- export default defineConfig({
- plugins: [
- vue(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- server: {
- host: '127.0.0.1',
- port: 9519, // 端口
- proxy: {
- '/api': { // 请求接口中要替换的标识
- target: 'http://127.0.0.1:8088', // 代理地址
- changeOrigin: true, // 是否允许跨域
- secure: true,
- rewrite: (path) => path.replace(/^\/api/, '/api') // api标志替换为''
- },
- }
- },
- base: '/',
- build: {
- chunkSizeWarningLimit: 1000,
- outDir: "dist",
- assetsDir: "assets", //指定静态资源存放路径
- // assetsPublicPath:'',
- sourcemap: true, //是否构建source map 文件
- terserOptions: {
- // 生产环境移除console
- compress: {
- drop_console: true,
- drop_debugger: true,
- },
- },
- }
- })
|