Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to detect wasm-pack target via cfg #795

Open
RReverser opened this issue Feb 20, 2020 · 1 comment
Open

Provide a way to detect wasm-pack target via cfg #795

RReverser opened this issue Feb 20, 2020 · 1 comment

Comments

@RReverser
Copy link
Member

💡 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"
));
@WenheLI
Copy link

WenheLI commented Apr 17, 2023

Just submitted a PR for this. Anyone would be able to review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants