rolldown icon indicating copy to clipboard operation
rolldown copied to clipboard

Reduce binary sizes by removing derived macros which is unnecessary in production

Open hyf0 opened this issue 1 year ago • 0 comments

To support writing test config in json format we add Deserialize, JsonSchema on BundlerOptions. So they are only for rust testing. Users of rolldown doesn't rely on these features.

https://github.com/rolldown/rolldown/blob/e39ddd845ac5ade81cdf1a2b8e0588c3eaf70f9b/crates/rolldown_common/src/inner_bundler_options/mod.rs#L14-L16

However, these test-only feature are compiled and increased the binary size. We don't want that. So we need hide these features using feature gate.

Guidance

See how oxc does this

  • https://github.com/oxc-project/oxc/blob/6de1b77b1b9bbace4661ffb59850e8fbe167dd6a/crates/oxc_ast/src/ast/js.rs#L39-L49
  • https://github.com/oxc-project/oxc/blob/main/crates/oxc_ast/Cargo.toml

hyf0 avatar Apr 07 '24 15:04 hyf0