Skip to content

Upgrade Vite 8 and Svelte tooling#12955

Draft
mtsgrd wants to merge 1 commit intomasterfrom
upgrade-vite8-svelte-tooling
Draft

Upgrade Vite 8 and Svelte tooling#12955
mtsgrd wants to merge 1 commit intomasterfrom
upgrade-vite8-svelte-tooling

Conversation

@mtsgrd
Copy link
Contributor

@mtsgrd mtsgrd commented Mar 20, 2026

Summary

  • Bumps Vite from 6.4.1 → 8.0.0, @sveltejs/kit 2.52.2 → 2.55.0, and @sveltejs/vite-plugin-svelte 6.2.4 → 7.0.0
  • Fixes CJS interop regressions in Vite 8/Rolldown for redux-persist: imports persistStore from the main ESM entry and replaces the lib/storage import with an inline localStorage wrapper
  • Skips oxc TypeScript preprocessing for node_modules Svelte files to prevent cross-block imports (e.g. createCommand) from being stripped
  • Sets css: "injected" for node_modules Svelte files to avoid PostCSS issues
  • Excludes svelte-lexical from pre-bundling and explicitly includes all @lexical/* packages (Vite 8 no longer auto-handles process.env.NODE_ENV for transitive deps of excluded packages)
  • Removes the now-invalid manualChunks rollup option (Rolldown replaces Rollup in Vite 8)
  • Fixes PrTemplateSection.svelte to use get(path) instead of a top-level $store subscription (required by Svelte 5 runes mode)

Test plan

  • pnpm dev starts without errors in apps/desktop
  • App renders and initializes correctly (layout mounts, redux-persist rehydrates)
  • Lexical editor (svelte-lexical) works without createCommand reference errors
  • PR template section loads and toggles correctly

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 20, 2026 14:35
@vercel
Copy link

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gitbutler-web Ready Ready Preview, Comment Mar 22, 2026 5:37pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades the Desktop app’s Vite/SvelteKit toolchain to Vite 8 and adjusts Vite/Svelte preprocessing and dependency optimization to work around Vite 8/Rolldown regressions (notably around CJS interop and Svelte preprocessing of node_modules).

Changes:

  • Bump Vite to 8.0.0 and update SvelteKit / vite-plugin-svelte versions in the workspace catalog.
  • Update Desktop Vite/Svelte config to avoid new Vite 8 + tooling pitfalls (dependency optimization, preprocessing, CSS handling for node_modules).
  • Adjust redux-persist integration and a Svelte component store access pattern for compatibility.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Updates catalog versions for Vite and Svelte tooling.
package.json Adds a pnpm override to force Vite 8.0.0 resolution.
apps/desktop/vite.config.ts Updates optimizeDeps handling for svelte-lexical/Lexical and removes manualChunks config.
apps/desktop/svelte.config.js Filters TS preprocessing for node_modules and injects CSS for node_modules Svelte files.
apps/desktop/src/lib/state/clientState.svelte.ts Changes redux-persist imports and replaces lib/storage with an inline localStorage wrapper.
apps/desktop/src/components/PrTemplateSection.svelte Switches to get(store) instead of using $store in script logic (Svelte 5 runes compatibility).

Comment on lines +58 to +59
"@lexical/dragon",
"@lexical/extension",
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optimizeDeps.include lists @lexical/dragon and @lexical/extension, but these packages don’t appear to be installed (no entries in pnpm-lock.yaml). With Vite, unresolved entries in optimizeDeps.include typically fail dependency optimization / dev server startup. Remove the non-existent entries, or add them as explicit dependencies (and pin via overrides/catalog) so they resolve consistently.

Suggested change
"@lexical/dragon",
"@lexical/extension",

Copilot uses AI. Check for mistakes.
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from fcb0503 to 8ebe295 Compare March 20, 2026 14:43
Copilot AI review requested due to automatic review settings March 20, 2026 14:56
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 8ebe295 to 3c0353a Compare March 20, 2026 14:56
@github-actions github-actions bot added the rust Pull requests that update Rust code label Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.

Comment on lines +35 to +37
getItem: (key: string) => Promise.resolve(localStorage.getItem(key)),
setItem: (key: string, value: string) => Promise.resolve(localStorage.setItem(key, value)),
removeItem: (key: string) => Promise.resolve(localStorage.removeItem(key)),
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline redux-persist storage wrapper calls localStorage.* inside Promise.resolve(...), which will throw synchronously if access fails (e.g., storage disabled/quota exceeded) instead of returning a rejected promise. Wrap the localStorage operations in try/catch (or use an async function) so failures are surfaced as promise rejections and don’t crash store initialization.

Suggested change
getItem: (key: string) => Promise.resolve(localStorage.getItem(key)),
setItem: (key: string, value: string) => Promise.resolve(localStorage.setItem(key, value)),
removeItem: (key: string) => Promise.resolve(localStorage.removeItem(key)),
getItem: async (key: string) => {
return localStorage.getItem(key);
},
setItem: async (key: string, value: string) => {
localStorage.setItem(key, value);
},
removeItem: async (key: string) => {
localStorage.removeItem(key);
},

Copilot uses AI. Check for mistakes.
Comment on lines 50 to +53
optimizeDeps: {
// Exclude local packages from pre-bundling
exclude: ["@gitbutler/core", "@gitbutler/ui", "@gitbutler/shared"],
// Force pre-bundling of lexical packages — they all use process.env.NODE_ENV
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions excluding svelte-lexical from Vite pre-bundling, but optimizeDeps.exclude here only lists the local @gitbutler packages. If svelte-lexical still needs to be excluded for Vite 8, add it to optimizeDeps.exclude; otherwise update the PR description to match the actual behavior.

Copilot uses AI. Check for mistakes.
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from d637c03 to 8eee90b Compare March 22, 2026 08:23
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 8eee90b to 0556734 Compare March 22, 2026 13:48
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 0556734 to 825cc00 Compare March 22, 2026 14:03
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 825cc00 to 4f606a5 Compare March 22, 2026 14:28
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 4f606a5 to 0bed009 Compare March 22, 2026 14:31
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 0bed009 to ab2da60 Compare March 22, 2026 15:04
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from ab2da60 to 9e16233 Compare March 22, 2026 15:15
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from 9e16233 to e9df533 Compare March 22, 2026 15:44
@mtsgrd mtsgrd force-pushed the upgrade-vite8-svelte-tooling branch from e9df533 to d309014 Compare March 22, 2026 16:35
Upgrade core build tooling:
- Vite 6.4.1 → 8.0.0 (via pnpm override + catalog)
- @sveltejs/kit 2.52.2 → 2.55.0
- @sveltejs/vite-plugin-svelte 6.2.4 → 7.0.0

Fix Vite 8 compatibility issues:
- Change build target from "modules" (unsupported by Rolldown) to "es2021"
- Remove empty manualChunks config (no longer needed)
- Add explicit optimizeDeps.include for all lexical packages — Vite 8
  no longer auto-handles process.env.NODE_ENV for transitive deps of
  excluded packages
- Filter vitePreprocess to skip node_modules scripts — transformWithOxc
  strips cross-block imports (e.g. <script module> using <script> values)
- Add style preprocessor to strip @import rules from node_modules — Svelte
  5's CSS parser rejects @import inside :global {} blocks
- Use css: "injected" for node_modules via dynamicCompileOptions
- Remove deprecated scss preprocessorOptions from apps/web
- Add HotUpdateOptions type annotation for Vite 8 API change
- Add prismjs as explicit dependency and import in test setup — @lexical/code
  requires globalThis.Prism

Improve E2E blackbox test diagnostics:
- Set E2E_TEST_APP_DATA_DIR to absolute path so Tauri logs are findable
- Upload GitButler backend logs, videos, and browser console logs as
  separate artifacts on test failure
- Capture browser console logs via getLogs("browser") on test failure
- Fix video recording path (remove extra /e2e/ prefix)
- Increase debounce reload delay from 5s to 8s for package changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants