Open
Description
💡 Feature description
Currently, there is no way to do perform conditional compilation based on the --target
passed to wasm-pack.
It would be great if wasm-pack
would pass it on via --cfg
to Rust (should be easy enough to pass it in RUSTFLAGS
), so that users could check this target in their code as any other conditional compilation attribute.
💻 Basic example
pub const HAS_ESM_SUPPORT: bool = cfg!(any(
wasm_pack_target = "bundler",
wasm_pack_target = "web"
));