import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; import path from "node:path"; import { createHtmlPlugin } from 'vite-plugin-html'; import { version } from './package.json' // https://vite.dev/config/ export default ({ mode }: any) => { const env = loadEnv(mode, process.cwd()) return defineConfig({ resolve: { alias: { "@/": `${path.resolve(__dirname, "src")}/`, }, }, css: { preprocessorOptions: { scss: { quietDeps: true, additionalData: ` @forward 'element-plus/theme-chalk/src/common/var' with ( $colors: ( 'primary': ( 'base': ${env.VITE_PRIMARY}, ), ), ); `, }, }, }, server: { port: 9000, open: true, host: "0.0.0.0", }, plugins: [ createHtmlPlugin({ template: 'index.html', entry: env.VITE_ENTRY, inject: { data: { title: env.VITE_TITLE, }, } }), vue() ], define: { __VERSION__: JSON.stringify(version) } }); };