You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
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: '<script src="./inject.js"></script>',
|
|
},
|
|
}),
|
|
],
|
|
})
|
|
|