Skip to content

feat: support additional bun compile args and --bytecode compatibility #18

@ramonmalcolm10

Description

@ramonmalcolm10

Problem

  1. There's no way to pass additional flags (e.g. --minify, --sourcemap, --bytecode) to bun build --compile during the adapter's
    compile step.
  2. The sveltekit server entry uses top-level await, which causes bun build --compile --bytecode to fail with:
    error: "await" can only be used inside an "async" function
  3. The gracefulShutdown handler runs twice on Ctrl+C because both SIGINT and SIGTERM fire, producing duplicate logs:
    Stopping server...
    Stopping server...
    Stopped server
    Stopped server

Proposed Changes

  • All packages (sveltekit, nuxt, tanstack): Add a bunArgs option that passes additional flags to bun build --compile
  • sveltekit: Wrap the server entry in an async IIFE to eliminate top-level await for --bytecode compatibility
  • sveltekit: Add a guard to gracefulShutdown to prevent duplicate execution

Usage

  // svelte.config.js
  adapter({
    bunArgs: ["--minify", "--sourcemap", "--bytecode"]
  })

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