Skip to content

Feature Request: Add Cargo features for tree-shaking to reduce binary size & support loading scripts from memory ( &str / &[u8] ) #3

Description

@YellowRiver6
  1. Allow trimming components via Cargo features to reduce binary size

Currently, even with the highest Rust optimization level in release mode (e.g.,  opt-level = "z"  or  "s" ), the compiled executable size still exceeds 100MB. For lightweight use cases (such as a simple HTTP server), many built-in components (like WebGPU, FFI, etc.) are completely unnecessary. It would be very helpful to introduce Cargo feature flags, allowing developers to selectively enable or disable specific components. This would make it much easier to tree-shake Deno and significantly reduce the final binary size.

  1. Support loading scripts from memory ( &str  /  &[u8] )

At present, libdeno only seems to support loading scripts from file system paths. However, in some scenarios (e.g., bundling JS/TS scripts directly into the Rust binary as embedded string resources), reading from the file system is not ideal. It would be great if an API could be provided to load and execute scripts directly from string slices or byte slices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions