Skip to content

Svelte renderer build fails after upgrading to Vite 8 / electron-vite 6.0.0-beta.1 #925

Description

@YImhof

Describe the bug

Electron-Vite is a real great tool, making Electron dev a lot more accessible.
I'm trying to upgrade a working Electron application (Electron 41 + Electron-Vite 5 + Vite 7 + Svelte 5 + Typescript 6) to Electron 42+ and Vite 8, but the renderer build fails with 3 errors, complaining with message "Expected token }".

I also tried with a fresh minimal project and obtained the same errors (zip archive of the project included).

minimal-electron-test.zip

Steps to reproduce:

(using pnpm 11.22 as package manager)

  1. npm create @quick-start/electron@latest, selecting Svelte and TypeScript.
  2. pn dev (make sure the application based on old packages versions can start)
  3. pn up --latest (update all dependencies)
  4. pn add -d typescript@6.0.3 (rollback to TS 6 as waiting for TS 7.1)
  5. pn add -d electron-vite@6.0.0-beta.1
  6. pn build

Actual result:

message "Expected token }" on following files:

  • [plugin vite-plugin-svelte:compile] rolldown/runtime.js 
  • [plugin vite-plugin-svelte:compile] src/renderer/src/main.ts
  • [plugin vite-plugin-svelte:compile] svelte/src/internal/client/index.js

Additional observations:

  • main build succeeds.
  • preload build succeeds.
  • renderer build fails.
  • reproduces in a clean project.
  • reproduces with Vite 8.0.0, 8.0.16, 8.2.1 and 8.2.2.
  • svelte-check passes.
  • no custom Vite or Svelte configuration required to reproduce.

Custom debug transform

Adding a simple custom debug transform shows following output:

  • TRANSFORM: rolldown/runtime.js
  • TRANSFORM: .../src/renderer/index.html
  • TRANSFORM: .../src/renderer/src/main.ts
  • TRANSFORM: .../node_modules/.pnpm/svelte@5.56.10_@typescript-eslint+types@8.67.0/node_modules/svelte/src/internal/client/index.js

Note: sorry when duplicate, but I cannot read chinese characters.

Electron-Vite Version

6.0.0-beta.1

Electron Version

43.4.1

Vite Version

8.2.2

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions