essentially vite and electron now can work together for live development of an app without dealing with possible dimension issues or any of the works
43 lines
928 B
TypeScript
43 lines
928 B
TypeScript
import path from "node:path"
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
|
|
const rootDirectory = import.meta.dirname
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
if (mode === "renderer") {
|
|
return {
|
|
root: path.join(rootDirectory, "/src/renderer"),
|
|
base: path.join(rootDirectory, "/release/app/dist/renderer"),
|
|
input: "index.html",
|
|
plugins: [react()],
|
|
resolve: {
|
|
// NOTE: Very important to set tsconfigPaths = true
|
|
// For compatibility with pathing of your web program
|
|
tsconfigPaths: true
|
|
},
|
|
build: {
|
|
outDir: path.join(rootDirectory, "/release/app/dist/renderer"),
|
|
emptyOutDir: true,
|
|
rolldownOptions: {
|
|
cwd: path.join(rootDirectory, "/src/renderer/"),
|
|
output: { entryFileNames: "renderer.js" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return {
|
|
|
|
}
|
|
|
|
})
|
|
|
|
/*
|
|
return {
|
|
renderer: {
|
|
root: path.join(rootDirectory, "src/renderer"),
|
|
base: "./"
|
|
}
|
|
}
|
|
*/
|