Skip to content

Commit

Permalink
fix: vite build
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 2, 2024
1 parent dff5a87 commit 03a4246
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default defineConfig({
define: {
APP_VERSION: JSON.stringify(pkg.version),
APP_NAME: JSON.stringify(pkg.productName),

},
},
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build:linux": "electron-vite build && electron-builder --linux",
"build:mac": "electron-vite build && electron-builder --mac",
"build:unpack": "npm run build && electron-builder --dir",
"build:web": "vite build",
"build:win": "npm run build && electron-builder --win",
"dev": "electron-vite dev",
"lint": "eslint",
Expand Down
28 changes: 28 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { readFileSync } from "node:fs"
import { resolve } from "node:path"
import { fileURLToPath } from "node:url"

import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"

const pkg = JSON.parse(readFileSync("package.json", "utf8"))
const __dirname = fileURLToPath(new URL(".", import.meta.url))
export default defineConfig({
build: {
outDir: resolve(__dirname, "out/web"),
target: "ES2022",
},
root: "./src/renderer",
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
"@shared": resolve("src/shared/src"),
},
},
base: "/",
plugins: [react()],
define: {
APP_VERSION: JSON.stringify(pkg.version),
APP_NAME: JSON.stringify(pkg.productName),
},
})

0 comments on commit 03a4246

Please sign in to comment.