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

refactor(common): Make ahash optional #7816

Merged
merged 7 commits into from
Aug 16, 2023

Conversation

dsherret
Copy link
Contributor

@dsherret dsherret commented Aug 15, 2023

Description:

This adds the ability to not include ahash with swc_common, which caused some issues for me compiling dprint-plugin-typescript to Wasm because of:

   Compiling ahash v0.8.3
   Compiling getrandom v0.2.10
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> C:\Users\david\.cargo\registry\src\index.crates.io-6f17d22bba15001f\getrandom-0.2.10\src\lib.rs:285:9
    |
285 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
286 | |                         default, you may need to enable the \"js\" feature. \
287 | |                         For more information see: \
288 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^

(I can't enable the JS feature because it's running the wasm file in Wasmer and also I don't support Wasi in dprint plugins)

BREAKING CHANGE:

This removes swc_common's "perf" feature and makes it the default, then adds an ahash feature instead. An alternative would be to make the ahash dep optional and part of the default features, then do default-features = false in the downstream crates (I think, but I'm not sure), but I figure most people will be using the perf default anyway? I'm not sure what's preferable.

Related issue:

@magic-akari
Copy link
Member

maybe fix #7729

@kdy1 kdy1 changed the title refactor: make ahash optional for swc_common refactor(common): Make ahash optional Aug 16, 2023
@kdy1 kdy1 enabled auto-merge (squash) August 16, 2023 18:01
@kdy1 kdy1 added this to the Planned milestone Aug 16, 2023
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc-bump:

  • swc_common

@kdy1 kdy1 merged commit 981d7b1 into swc-project:main Aug 16, 2023
129 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.3.78 Aug 17, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

New wasm32-unknown-unknown plugin created via swc cli is broken
3 participants