123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import monacoEditorPlugin from 'vite-plugin-monaco-editor';
- import removeConsole from 'vite-plugin-remove-console';
- import compression from 'vite-plugin-compression';
- //1、 导入 path 模块,帮助我们解析路径
- import { resolve } from 'path'
- //2-1 自动导入vue中hook reactive ref等
- import AutoImport from 'unplugin-auto-import/vite'
- //2-2 自动导入ui-组件 比如说ant-design-vue element-plus等
- import Components from 'unplugin-vue-components/vite'
- //3、vue3语法糖
- import VueSetupExtend from 'vite-plugin-vue-setup-extend'
- // https://vitejs.dev/config/
- export default defineConfig(({ mode }) => {
- const config = loadEnv(mode, './');
- if (mode === 'development') console.debug('Loaded env:', config);
- return {
- base: "./",
- plugins: [
- vue(),
- removeConsole(),
- compression(),
- monacoEditorPlugin({}),
- AutoImport({
- imports: ['vue', 'vue-router'],
- dts: "src/auto-import.d.ts",
- }),
- Components({
- dts: "src/components.d.ts",
- }),
- VueSetupExtend(),
- ],
- resolve: {
- alias: {
- '@': resolve('src'),
- '@views': resolve('src/views')
- }
- },
- server: {
- proxy: {
- '/api': {
- target: 'https://www.adicn.com/eps',
- secure: false,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
- },
- '/eps': {
- target: 'https://www.adicn.com/eps',
- secure: false,
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/eps/, '')
- },
- '/file': {
- target: 'http://192.168.0.43:2201/',
- secure: false,
- changeOrigin: true,
- rewrite: path => path.replace(/^\/file/, '')
- },
- '/websocket': { // 原为 websockt,修正拼写
- target: 'http://192.168.0.104:8188',
- secure: false,
- changeOrigin: true
- },
- }
- },
- css: {
- preprocessorOptions: {
- scss: {
- // optional: global SCSS variables/mixins
- // additionalData: `@import "@/styles/variables.scss";`
- }
- }
- }
- };
- });
|