Skip to content

fix: use --preload for Bun instead of --import#16

Merged
Lojhan merged 1 commit into
mainfrom
fix/bun-preload-flag
Apr 22, 2026
Merged

fix: use --preload for Bun instead of --import#16
Lojhan merged 1 commit into
mainfrom
fix/bun-preload-flag

Conversation

@Lojhan
Copy link
Copy Markdown
Collaborator

@Lojhan Lojhan commented Apr 22, 2026

Summary

  • Use `--preload` flag for Bun instead of `--import=` as Bun uses positional arguments for preload
  • Added `bunPreloadFlag` constant in plugin-command.ts
  • Added branch in extraImports logic to select correct flag based on runtime

Fix Details

Bun requires `--preload` as a positional argument (e.g., `--preload /path/to/file`) rather than `--import=/path/to/file` which is used for Node.js and Deno. This fix updates the plugin-command to properly handle Bun's CLI arguments.

Test

Added test case verifying that `buildRunnerCommand` produces `--preload /tmp/dom-setup.ts` for Bun runtime instead of `--import=`.

- Added bunPreloadFlag constant using --preload flag for Bun runtime
- Added branch in extraImports logic to use correct flag per runtime
- Added test case verifying Bun uses --preload flag
@Lojhan Lojhan merged commit 7db0e16 into main Apr 22, 2026
10 checks passed
@Lojhan Lojhan deleted the fix/bun-preload-flag branch April 22, 2026 12:43
@Lojhan Lojhan linked an issue Apr 22, 2026 that may be closed by this pull request
5 tasks
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.

Bug: @pokujs/react injects --import=<setup> on Bun, which Bun ignores silently

1 participant