123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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: 9010,
- 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)
- }
- });
- };
|