tsconfig.json and vite.config.ts makes things difficult to build but we're getting somewhere on it. I'm likely going to change these files and perhaps the layout of the project as it grows, especially for the debugging parts and building parts (e.g ./dist/ and the ts, vite, and node configs) so far, its going well, slow and steady start, the next thing I need to target is fixing to why electron won't load built vite files and figure out how to run electron and vite together perhaps as a means of making debugging / programming easier
42 lines
893 B
TypeScript
42 lines
893 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: "/",
|
|
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: {
|
|
input: path.join(rootDirectory, "/src/renderer/index.html"),
|
|
//output: { entryFileNames: "release/app/dist/renderer/renderer.js" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return {
|
|
|
|
}
|
|
|
|
})
|
|
|
|
/*
|
|
return {
|
|
renderer: {
|
|
root: path.join(rootDirectory, "src/renderer"),
|
|
base: "./"
|
|
}
|
|
}
|
|
*/
|