electron-vite/vite-plugin-electron

0.10.2 Broke Our Workflow

mrrosoff opened this issue · 5 comments

Hi There,

There is no issue template so let me know if this is the right place. This (f28e66bdf1e6c4be28497865acab2e3db12b0e6b) commit broke our workflow for a package.

Can you explain your reasoning for transitioning from dist/electron to dist-electron? This makes development vs production builds bundle to different directories, which confuses the main entrypoint path in package.json. We will not be able to upgrade to v0.10.2 until this is reverted.

Thanks.

Thans for your feedback!
The dist folder will be cleaned by Vite by default, so we have to explicitly set emptyDir: false to avoid this behavior.
I observed that Vite's ssr code is built into dist-ssr, maybe we also need to use dist-electron like ssr would be more ideal.

But, you can set the outDir for your projects.

export default defineConfig({
  plugins: [
    electron({
      entry: 'electron/main.ts',
      vite: {
        build: {
+         outDir: 'dist/electron',
        },
      },
    }),
  ],
})

Thanks! That makes sense. I guess I would be careful overriding the Vite default behavior like that, although allowing this setting makes sense. Would it be possible to add it to the documentation somewhere as an example? Also I think your commit/changelog has a typo and just says dist/electron -> dist/electron.

I can also make a PR if that helps, although you seem to be the core contributor, so I don't want to step on any toes.

Looking forward to receiving your PR :)