From ca22cdd5550cfa0defb0f430c538698182cdaec1 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 30 十二月 2024 16:42:49 +0800 Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat-ui-vue3 --- vite.config.ts | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 8cba915..891e5f9 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,8 +43,9 @@ css: { preprocessorOptions: { scss: { - additionalData: '@import "./src/styles/variables.scss";', - javascriptEnabled: true + additionalData: '@use "@/styles/variables.scss" as *;', + javascriptEnabled: true, + silenceDeprecations: ["legacy-js-api"], } } }, @@ -71,8 +72,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