| | |
| | | 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() |
| | | |
| | |
| | | } |
| | | |
| | | // 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) { |
| | |
| | | css: { |
| | | preprocessorOptions: { |
| | | scss: { |
| | | additionalData: '@import "./src/styles/variables.scss";', |
| | | additionalData: '@use "@/styles/variables.scss" as *;', |
| | | javascriptEnabled: true |
| | | } |
| | | } |
| | |
| | | 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} |
| | | } |
| | | } |