electron-vite/vite-plugin-electron

vite-plugin-electron does not create nested folders inside electron-dist folder by default

T1-Zed opened this issue · 1 comments

Im trying to struct my electron folder like this:

enter image description here

but vite-plugin-electron doesn't create the api folder instead it compiles on the root folder:

enter image description here

this is my vite config file:

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    electron([
      {
        // Main-Process entry file of the Electron App.
        entry: "electron/main.ts",
      },
      {
        entry: "electron/preload.ts",
        onstart(options) {
          // Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
          // instead of restarting the entire Electron App.
          options.reload();
        },
      },
      {
        entry: "electron/api/upload.ts",
      },
    ]),
    renderer(),
  ],
});
  {
    entry: 'electron/api/upload.ts',
+   vite: {
+     build: {
+       outDir: 'dist-electron/api',
+     },
+   },
  },