Skip to content

svelte: the compiler loads as it is under Bun - #47

Merged
ppmpreetham merged 1 commit into
mainfrom
fix/svelte-bun
Nov 22, 2026
Merged

ppmpreetham merged 1 commit into
mainfrom
fix/svelte-bun

Conversation

@ppmpreetham

@ppmpreetham ppmpreetham commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

What does this change?

Svelte apps failed under Bun on a cold compile cache: the Bun plugin's onLoad filter (BROWSER_PACKAGE_FILE) also matched svelte/compiler, a UMD file, and served it as an ES module with no exports. The filter now skips svelte/compiler ((?!compiler[\\/])), with a comment saying why.

How was it tested?

  • Added or updated a test for this change: bindings/svelte/test/runtime.test.js, "bun runs it with a cold compile cache (the compiler loads as it is)", which runs in a temp directory with an empty node_modules
  • Reproduced the failure first, then confirmed the test passes with the fix

Checklist

  • CHANGELOG.md updated (Unreleased)
  • Docs updated (not user-facing beyond the fix)
  • New files carry the SPDX-License-Identifier: GPL-2.0-or-later header

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a compilation failure that could occur when running Svelte apps with Bun and an empty compilation cache. Svelte apps can now compile successfully on a cold start, including when run from a directory without an existing node_modules folder.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Svelte package matcher now excludes svelte/compiler paths. A Bun test runs the app from a temporary directory with an empty cache and checks that the run populates the Svelte compilation cache.

Changes: Svelte cold-cache compilation

Layer / File(s) Summary
Compiler loading and cold-cache test
bindings/svelte/compile.js, bindings/svelte/test/runtime.test.js, CHANGELOG.md
BROWSER_PACKAGE_FILE excludes svelte/compiler paths. A Bun test checks app execution and cache population from a temporary empty cache. The changelog records the change.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 612e1

This fixes Svelte apps failing on Bun with a cold compile cache by letting Bun load the compiler as-is. A test covers the scenario. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 612e1

The fix lets Bun load the existing Svelte compiler normally instead of treating it as an ES module. The inspected change introduces no material security, isolation, persistence, or rollback risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the Svelte compiler loading under Bun, which matches the main change: the Bun plugin's onLoad filter now skips svelte/compiler, so the UMD compiler file loads correctly on a cold compi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the Svelte compiler loading under Bun, which matches the main change: the Bun plugin's onLoad filter now skips svelte/compiler, so the UMD compiler file loads correctly on a cold compile cache. The title is specific and describes the primary fix, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5405a362-757f-4c7d-9bcf-7ad649a1802a
Commits

Reviewing files that changed from the base of the PR and between 7e54071 and 612e168.

Files selected for processing: 3

  • CHANGELOG.md
  • bindings/svelte/compile.js
  • bindings/svelte/test/runtime.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@ppmpreetham
ppmpreetham merged commit 856765f into main Nov 22, 2026
24 checks passed
ppmpreetham added a commit that referenced this pull request Nov 22, 2026
@ppmpreetham
ppmpreetham deleted the fix/svelte-bun branch November 22, 2026 16:46
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