逻辑编排前端

vite.config.ts 3.4KB

    /* * @Author: Devin * @Date: 2022-11-10 15:07:57 * @LastEditors: Devin * @LastEditTime: 2023-02-23 16:50:02 * @Description: aiot配置 */ import { defineConfig } from 'vite'; import eslintPlugin from 'vite-plugin-eslint'; import path from 'path'; import vue from '@vitejs/plugin-vue'; import qiankun from 'vite-plugin-qiankun'; // @ts-ignore import viteCompression from 'vite-plugin-compression'; import { visualizer } from 'rollup-plugin-visualizer'; import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; // https://vitejs.dev/config/ // @ts-ignore // @ts-ignore export default defineConfig(({ mode }) => { return { // base: mode === 'development' ? './' : 'http://10.19.14.26:8100/', base: mode === 'development' ? './' : './', plugins: [ vue(), viteCommonjs(), visualizer({ open: true, // 注意这里要设置为true,否则无效 gzipSize: true, brotliSize: true }), qiankun('aiot-plateform', { useDevMode: true }), eslintPlugin({ include: ['src/**/*.js', 'src/**/*.vue', 'src/**/*.jsx', 'src/**/*.ts'], // exclue: ['./node_modules/**'], cache: false }), viteCompression({ verbose: true, disable: false, threshold: 102400, algorithm: 'gzip', ext: '.gz' }) ], css: { preprocessorOptions: { scss: { // additionalData: `@use "@/assets/css/variable.scss";` } } }, resolve: { alias: [ { find: '@', replacement: path.resolve('src') } ] }, build: { outDir: 'qb-logic-flow-front', chunkSizeWarningLimit: 500, minify: 'terser', cssCodeSplit: true, terserOptions: { compress: { drop_console: true, // 打包时删除console drop_debugger: true, // 打包时删除 debugger pure_funcs: ['console.log'] }, output: { // 去掉注释内容 comments: true } }, rollupOptions: { output: { // 静态资源分类打包 vue: ['vue'], axios: ['axios'], vuex: ['vuex'], router: ['vue-router'], elementPlus: ['element-plus'], chunkFileNames: 'static/js/[name]-[hash].js', entryFileNames: 'static/js/[name]-[hash].js', assetFileNames: 'static/[ext]/[name]-[hash].[ext]', manualChunks(id) { // 静态资源分拆打包 if (id.includes('node_modules')) { return id .toString() .split('node_modules/')[1] .split('/')[0] .toString(); } } } } }, server: { open: true, // headers: { // 'Access-Control-Allow-Origin': '*' // }, origin: 'http://localhost:8808', host: '0.0.0.0', port: 8808, proxy: { '^/ipu': { target: 'http://8.130.24.19:8107', changOrigin: true, rewrite: (path) => path.replace(/^\/ipu/, '/ipu') }, '^/logic': { target: 'http://8.130.24.19:8106', changOrigin: true, rewrite: path => path.replace(/^\/logic/, '/') }, '^/df': { target: 'http://8.130.24.19:8082', changOrigin: true, rewrite: path => path.replace(/^\/df/, '/df') } } } }; });