alex8088 / electron-vite

Next generation Electron build tooling based on Vite 新一代 Electron 开发构建工具,支持源代码保护
https://electron-vite.org
MIT License
3.57k stars 153 forks source link

build.target error #589

Open Deca opened 3 months ago

Deca commented 3 months ago

Describe the bug

When I try to run the app in the dev environment I get this error: ERROR build.target option is required in the electron vite main config.

Is my first time using electron and electron-vite so I'm probably missing somethig basic in any case I tried to configure the electron.vite.config.js by looking at the examples in the repo. In the documentation and the examples I can't find any useful hint about that build.target option, is that really mandatory as the error suggest? This is my config

import { defineConfig } from 'electron-vite';
import { resolve } from 'path';

export default defineConfig({
  main: {
    // Main process entry point
    entry: 'src/main/index.js', 
    build: {
      outDir: 'dist/main',
    },
  },
  preload: {
    // Preload script entry point
    entry: 'src/preload/index.js',
    build: {
      outDir: 'dist/preload',
    },
  },
  renderer: {
    // Renderer process entry point
    entry: 'src/renderer/index.js',
    root: resolve(__dirname, 'src/renderer'),
    build: {
      outDir: 'dist/renderer',
    },
  },
});

Electron-Vite Version

2.3

Electron Version

5.2.4

Vite Version

5.4

Validations