From 3357b5f0f0919f7a52cd32a6d6de0acb14e0daaf Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 17 十二月 2024 17:29:01 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- vite.config.ts | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 8cba915..640fe50 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,8 @@ -import { resolve } from 'path' -import { loadEnv } from 'vite' -import type { UserConfig, ConfigEnv } from 'vite' -import { createVitePlugins } from './build/vite' -import { include, exclude } from "./build/vite/optimize" +import {resolve} from 'path' +import type {ConfigEnv, UserConfig} from 'vite' +import {loadEnv} from 'vite' +import {createVitePlugins} from './build/vite' +import {exclude, include} from "./build/vite/optimize" // 当前执行node命令时文件夹的地址(工作目录) const root = process.cwd() @@ -12,7 +12,7 @@ } // https://vitejs.dev/config/ -export default ({ command, mode }: ConfigEnv): UserConfig => { +export default ({command, mode}: ConfigEnv): UserConfig => { let env = {} as any const isBuild = command === 'build' if (!isBuild) { @@ -43,7 +43,7 @@ css: { preprocessorOptions: { scss: { - additionalData: '@import "./src/styles/variables.scss";', + additionalData: '@use "@/styles/variables.scss" as *;', javascriptEnabled: true } } @@ -71,8 +71,15 @@ drop_debugger: env.VITE_DROP_DEBUGGER === 'true', drop_console: env.VITE_DROP_CONSOLE === 'true' } - } + }, + rollupOptions: { + output: { + manualChunks: { + echarts: ['echarts'] // 将 echarts 单独打包,参考 https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues/IAB1SX 讨论 + } + }, + }, }, - optimizeDeps: { include, exclude } + optimizeDeps: {include, exclude} } } -- Gitblit v1.9.3