import { defineConfig } from "vite" import reactRefresh from "@vitejs/plugin-react-refresh" // import WindiCSS from "vite-plugin-windicss" const { resolve, join } = require("path") // import electron from "vitejs-plugin-electron" import { minifyHtml, injectHtml } from "vite-plugin-html" console.log(process.env.NO); // https://vitejs.dev/config/ export default defineConfig({ root: resolve(__dirname, "src/render"), base: "./", css: { preprocessorOptions: { scss: { additionalData: `@import "@/assets/style/global.scss";`, }, }, }, server: { port: +process.env.PORT, }, build: { outDir: resolve(__dirname, "dist/electron"), emptyOutDir: true, minify: false, commonjsOptions: {}, assetsDir: "", // 相对路径 加载问题 sourcemap: true, }, resolve: { alias: { "@": join(__dirname, "src/render"), "@render": join(__dirname, "src/render"), "@main": join(__dirname, "src/main"), "@src": join(__dirname, "src"), "@root": __dirname, }, }, // electron() plugins: [ reactRefresh(), minifyHtml(), injectHtml({ injectData: { title: "vite-plugin-htmlaa-example", // injectScript: '', }, }), ], })