| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- // import vueDevTools from 'vite-plugin-vue-devtools';
- import { visualizer } from 'rollup-plugin-visualizer';
- import viteCompression from 'vite-plugin-compression';
- import viteImagemin from 'vite-plugin-imagemin';
- /**
- * 按需加载
- * @see https://arco.design/vue/docs/start#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD%EF%BC%88%E6%A8%A1%E6%9D%BF%EF%BC%89
- */
- import AutoImport from 'unplugin-auto-import/vite';
- import Components from 'unplugin-vue-components/vite';
- import { ArcoResolver } from 'unplugin-vue-components/resolvers';
- import { config_compression, config_imagemin } from './scripts/vite-conf';
- // https://vitejs.dev/config/
- export default defineConfig(({ mode }) => {
- return {
- /**
- * 项目根目录
- * @see https://cn.vite.dev/config/shared-options.html#root
- */
- root: './src',
- /**
- * 静态资源目录,相对于 src/index.html 文件
- * @see https://cn.vite.dev/config/shared-options.html#publicdir
- */
- publicDir: '../public',
- server: {
- port: 5173,
- host: '0.0.0.0', // IP配置,支持从IP启动
- proxy: {
- '/api/': {
- target: 'http://smartai.com:8164',
- changeOrigin: true,
- secure: false,
- ws: true,
- cors: true,
- rewrite: (path) => path.replace(/^\/proxy_url/, '')
- },
- '/dify': {
- target: 'http://192.168.20.119:28003/',
- changeOrigin: true,
- secure: false,
- ws: true,
- rewrite: (path) => path.replace(/^\/dify/, '')
- },
- '/rgflow': {
- target: 'http://192.168.20.119:28002/',
- changeOrigin: true,
- secure: false,
- ws: true,
- rewrite: (path) => path.replace(/^\/rgflow/, '')
- }
- }
- },
- build: {
- /**
- * 构建输出目录,相对于 src/index.html 文件
- * @see https://cn.vite.dev/config/build-options.html#build-outdir
- */
- outDir: '../dist',
- emptyOutDir: true,
- rollupOptions: {
- output: {
- manualChunks: {
- 'vue-vendor': ['vue', 'vue-router', 'pinia']
- }
- }
- },
- terserOptions: {
- output: {
- // 去掉注释内容
- comments: true
- }
- }
- },
- plugins: [
- vue(),
- // /**
- // * @see https://devtools.vuejs.org/guide/vite-plugin
- // */
- // vueDevTools({
- // launchEditor: 'code'
- // }),
- visualizer({ open: false }),
- viteCompression(config_compression),
- viteImagemin(config_imagemin),
- /**
- * 按需加载
- * @see https://arco.design/vue/docs/start#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD%EF%BC%88%E6%A8%A1%E6%9D%BF%EF%BC%89
- */
- AutoImport({
- resolvers: [ArcoResolver()]
- }),
- Components({
- resolvers: [
- ArcoResolver({
- sideEffect: true
- })
- ]
- })
- ]
- };
- });
|