electron-vite/vite-plugin-electron

Startup not triggered with multiple build inputs

dcarr45 opened this issue · 3 comments

I may be misunderstanding the expected config, but this configuration of multiple input files that was working in 0.14.1 no longer works in 0.15.x due to #166:

{
    entry: ['main.ts', 'preload.ts', 'redis.ts'],
    vite: {
      build: {
        outDir: './dist/electron',
        emptyOutDir: true,
        rollupOptions: {
          output: {
            format: 'commonjs',
          },
        },
        sourcemap: 'inline',
      },
    },
    onstart(args) {
      void args.startup(['./dist/electron/main.js']);
    },
  },

It seems that the closeBundle() event is only fired once during vite serve, regardless of the number of entry/input files, so this condition

if (++closeBundleCount < entryCount) return

is never met.

I'm on vite@4.5.0

Hey! thanks for the tip!

Hi, I met the same issue.

Finally I found that, in v0.15.x, we should config the plugin like:

 electron([
        {
          entry: "app/main/main-entry.ts",
          vite: {
            
          }
        },
        {
          entry: "app/main/second-entry.ts",
          vite: {
            
          }
        }
]),

@GeoffreyChen777 Hey! 👋
This BUG fixed in v0.15.5, doesn't this work for you?

See here 👉 f57a60a


image