Skip to content

fix(deps): complete vite 8 migration (drop stale vite ^7 override) - #6434

Merged
daggerstuff merged 1 commit into
stagingfrom
churn/vite8-migration
Oct 30, 2026
Merged

daggerstuff merged 1 commit into
stagingfrom
churn/vite8-migration

Conversation

@daggerstuff

@daggerstuff daggerstuff commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Completes the vite 8 migration that the manifests already declared but the lockfile never resolved.

  • Root cause: pnpm-workspace.yaml carried stale overrides entries — vite: ^7 and @vitejs/plugin-react: ^5.2.0 — while root package.json declares vite ^8.3.5 and @vitejs/plugin-react ^6.1.1. The override won, so the lockfile resolved vite 7.3.7, below astro 7.3.5's own ^8.0.13 dependency range. Dropping the two stale overrides restores the declared resolution: vite 8.3.5.
  • Vite 8 code adjustments (rolldown/oxc pipeline):
    • astro.config.mjs: narrow the react() include globs to {js,jsx,ts,tsx}. The broad **/components/**/* glob also matched .module.css, which leaks scoped CSS into the OXC JS transform.
    • apps/web/src/lib/search-browser.ts + @types/flexsearch.d.ts: drop the flexsearch/dist/module/document fallback dynamic import, which Vite 8 cannot analyse.

Why now

astro 7.4.x (dependabot #6419) imports transformWithOxc from vite; vite 7 has no such export, so that PR cannot install or build until the workspace is genuinely on vite 8. This unblocks it.

Verification

  • pnpm install --lockfile-only --frozen-lockfile passes in-sandbox against the regenerated lockfile (102 ms, 17 importers).
  • Lockfile resolves [email protected] and @vitejs/[email protected]; astro stays 7.3.5 with its existing patch hash.
  • Full CI on this PR is the authoritative gate.

Summary by Sourcery

Complete the Vite 8 migration so the workspace resolves compatible dependencies and builds correctly with the new toolchain.

Bug Fixes:

  • Complete the Vite 8 migration by removing stale Vite 7 dependency overrides and updating the lockfile to resolve Vite 8.3.5 with the compatible React plugin.
  • Fix Vite 8 build compatibility by limiting React transforms to JavaScript and TypeScript files and removing the unsupported FlexSearch fallback import.

Build:

  • Regenerate the pnpm lockfile with the workspace's declared Vite 8 dependency versions.

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
pixelated Ready Ready Preview Oct 30, 2026 2:45am UTC

Request Review

@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Completes the Vite 8 migration by removing stale Vite 7/plugin overrides, regenerating the lockfile to resolve Vite 8.3.5, and adjusting React and FlexSearch integration for Vite 8's Rolldown/OXC transform behavior.

Sequence diagram for Vite 8 browser search initialization

sequenceDiagram
    participant App as Browser search
    participant FlexSearch as flexsearch
    participant Client as BrowserSearchClient

    App->>FlexSearch: import('flexsearch')
    FlexSearch-->>App: Document constructor
    App->>Client: new BrowserSearchClient(Document, config)
    Client-->>App: initialized search client
Loading

File-Level Changes

Change Details Files
Remove stale dependency overrides and regenerate the lockfile to resolve the workspace consistently to Vite 8.
  • Delete the Vite 7 and React plugin 5 overrides.
  • Regenerate dependency resolutions to Vite 8.3.5 and @vitejs/plugin-react 6.1.1 while preserving the existing Astro resolution.
  • Update lockfile metadata and package entries accordingly.
pnpm-workspace.yaml
pnpm-lock.yaml
Adapt React transformation configuration for Vite 8's Rolldown/OXC pipeline.
  • Restrict React plugin include globs to JavaScript and TypeScript extensions.
  • Prevent CSS module files from entering the OXC JavaScript transform.
astro.config.mjs
Remove the unsupported FlexSearch fallback import used by the browser search initializer.
  • Keep the analyzable flexsearch dynamic import as the sole loading path.
  • Remove fallback error handling and obsolete module declarations for flexsearch/dist/module/document.
apps/web/src/lib/search-browser.ts
apps/web/src/@types/flexsearch.d.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

Copy link
Copy Markdown

px Advisor Review

Risk: unknown

No summary available

No findings.

The workspace declared vite ^8.3.5 but a stale overrides entry pinned
vite ^7 (and @vitejs/plugin-react ^5), so the lockfile resolved vite
7.3.7 - below astro 7.3.5's own ^8.0.13 requirement. Drop the stale
overrides so the declared versions resolve.

Vite 8 (rolldown/oxc) needs two code adjustments:
- astro.config: narrow the react() include globs to JS/TS so .module.css
  files no longer leak into the OXC JS pipeline.
- search-browser: drop the flexsearch/dist/module/document fallback
  import that Vite 8 cannot analyse.
@daggerstuff
daggerstuff force-pushed the churn/vite8-migration branch from 03af941 to b88ebb5 Compare October 30, 2026 02:44

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@github-actions

Copy link
Copy Markdown

Lighthouse CI Results

Routes audited: /, /dashboard?perf=1, /training-session

Thresholds: Performance ≥90 | Accessibility ≥90 | Best Practices ≥85

Reports

  • lhr-1793328193032
  • lhr-1793328204266
  • lhr-1793328215131
  • lhr-1793328225652
  • lhr-1793328236085
  • lhr-1793328246539
  • lhr-1793328256965
  • lhr-1793328267361
  • lhr-1793328277768

Reports are also available as workflow artifacts

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="astro.config.mjs" line_range="652-654" />
<code_context>
+        // pipeline (esbuild in Vite 7 sniffed the loader and silently
+        // ignored it). `@astrojs/react` only transforms JSX/TSX, so the
+        // narrowed set is sufficient.
+        include: [
+          '**/react/*.{js,jsx,ts,tsx}',
+          '**/components/**/*.{js,jsx,ts,tsx}',
+        ],
         experimentalReactChildren: true,
</code_context>
<issue_to_address>
**Docker builds fail on component CSS**

When a Docker build selects `infra/docker/astro.config.mjs` and processes component CSS modules, the broad `include` in `infra/docker/astro.config.mjs` also matches component `.module.css` files, so Vite 8 sends the CSS through OXC's JavaScript transform and the Docker build fails.

Restrict the Docker config's `include` patterns to JavaScript and TypeScript files.
</issue_to_address>

### Comment 2
<location path="apps/web/src/lib/search-browser.ts" line_range="241-248" />
<code_context>
-        throw error
-      }
+    // Use dynamic import with module specifier pattern that Vite can analyze
+    const flexsearchPath = 'flexsearch'
+    const flexsearch = (await import(flexsearchPath)) as {
+      default?: { Document?: FlexSearchDocumentConstructor }
+      Document?: FlexSearchDocumentConstructor
     }
+    Document = (flexsearch.default?.Document ??
+      flexsearch.Document) as FlexSearchDocumentConstructor

     if (Document) {
       return new BrowserSearchClient(Document, config)
</code_context>
<issue_to_address>
**Search disappears on root import failure**

When the `flexsearch` root entry fails to load while its document subpath is still available, `initBrowserSearch` now tries only the `flexsearch` entry point; when that entry cannot load but `flexsearch/dist/module/document` remains loadable, the catch returns an empty fallback client, so browser search produces no results. The error is logged, but the removed alternate import no longer recovers.

Retain a Vite-analyzable recovery path for the document subpath, or verify that all supported browser builds can load the root entry before removing the fallback.
</issue_to_address>

Fix all in Cursor

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: astro.config.mjs:654, apps/web/src/lib/search-browser.ts:248


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread astro.config.mjs
Comment on lines +652 to +654
include: [
'**/react/*.{js,jsx,ts,tsx}',
'**/components/**/*.{js,jsx,ts,tsx}',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium · Docker builds fail on component CSS

When a Docker build selects infra/docker/astro.config.mjs and processes component CSS modules, the broad include in infra/docker/astro.config.mjs also matches component .module.css files, so Vite 8 sends the CSS through OXC's JavaScript transform and the Docker build fails.

Restrict the Docker config's include patterns to JavaScript and TypeScript files.

Prompt for AI agents
In `astro.config.mjs` at lines 652-654:

**Docker builds fail on component CSS**

When a Docker build selects `infra/docker/astro.config.mjs` and processes component CSS modules, the broad `include` in `infra/docker/astro.config.mjs` also matches component `.module.css` files, so Vite 8 sends the CSS through OXC's JavaScript transform and the Docker build fails.

Restrict the Docker config's `include` patterns to JavaScript and TypeScript files.

Fix in Cursor

Comment on lines +241 to 248
const flexsearchPath = 'flexsearch'
const flexsearch = (await import(flexsearchPath)) as {
default?: { Document?: FlexSearchDocumentConstructor }
Document?: FlexSearchDocumentConstructor
}
Document = (flexsearch.default?.Document ??
flexsearch.Document) as FlexSearchDocumentConstructor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium · Search disappears on root import failure

When the flexsearch root entry fails to load while its document subpath is still available, initBrowserSearch now tries only the flexsearch entry point; when that entry cannot load but flexsearch/dist/module/document remains loadable, the catch returns an empty fallback client, so browser search produces no results. The error is logged, but the removed alternate import no longer recovers.

Retain a Vite-analyzable recovery path for the document subpath, or verify that all supported browser builds can load the root entry before removing the fallback.

Prompt for AI agents
In `apps/web/src/lib/search-browser.ts` at lines 241-248:

**Search disappears on root import failure**

When the `flexsearch` root entry fails to load while its document subpath is still available, `initBrowserSearch` now tries only the `flexsearch` entry point; when that entry cannot load but `flexsearch/dist/module/document` remains loadable, the catch returns an empty fallback client, so browser search produces no results. The error is logged, but the removed alternate import no longer recovers.

Retain a Vite-analyzable recovery path for the document subpath, or verify that all supported browser builds can load the root entry before removing the fallback.

Fix in Cursor

@github-actions

Copy link
Copy Markdown

px Advisor Review

Risk: unknown

No summary available

No findings.

Comment on lines +228 to +235
// Use dynamic import with module specifier pattern that Vite can analyze
const flexsearchPath = 'flexsearch'
const flexsearch = (await import(flexsearchPath)) as {
default?: { Document?: FlexSearchDocumentConstructor }
Document?: FlexSearchDocumentConstructor
}
Document = (flexsearch.default?.Document ??
flexsearch.Document) as FlexSearchDocumentConstructor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Dynamic import using a variable await import(flexsearchPath) cannot be statically analyzed by bundlers, causing module resolution failure in the browser.
Severity: HIGH

Suggested Fix

Use a static string literal in the dynamic import, such as await import('flexsearch'), allowing bundlers to detect, bundle, and resolve the module properly for the browser.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: apps/web/src/lib/search-browser.ts#L228-L235

Potential issue: Dynamic import uses a variable specifier `await import(flexsearchPath)`
instead of a string literal. Because bundlers like Vite and rolldown cannot statically
analyze dynamic imports with variable specifiers, the bare module specifier is left
untouched in the client bundle. At runtime in the browser, resolving bare specifiers
fails without an import map, rejecting the import promise and falling back to a dummy
client that always returns empty search results.

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

Copy link
Copy Markdown

Lighthouse CI Results

Routes audited: /, /dashboard?perf=1, /training-session

Thresholds: Performance ≥90 | Accessibility ≥90 | Best Practices ≥85

Reports

  • lhr-1793328372469
  • lhr-1793328385207
  • lhr-1793328397360
  • lhr-1793328408772
  • lhr-1793328420133
  • lhr-1793328431519
  • lhr-1793328442871
  • lhr-1793328454301
  • lhr-1793328465596

Reports are also available as workflow artifacts

@daggerstuff
daggerstuff merged commit c648884 into staging Oct 30, 2026
39 of 43 checks passed
@daggerstuff
daggerstuff deleted the churn/vite8-migration branch October 30, 2026 02:51
@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

DEA-170

This branch was successfully deployed

1 active deployment
Preview — b88ebb54 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant