myFavShrimp / turf

Macro based compile-time SCSS transpilation, CSS minification, and class name uniquification toolchain inspired by CSS modules.
MIT License
50 stars 2 forks source link

[Bug] - `v0.3.0` - expected `Targets`, found `Option<_>` #1

Closed xeho91 closed 1 year ago

xeho91 commented 1 year ago

Hi πŸ‘‹ ,

Thanks for this fantastic cargo package. I love CSS modules; your work is the most similar solution I could find. Kudos!

I believe you should consider adding it to Awesome Yew.

I've encountered this bug while trying to use your example using the yew framework:

2023-06-07T09:34:40.980547Z  INFO πŸ“¦ starting build
2023-06-07T09:34:40.981270Z  INFO spawning asset pipelines
2023-06-07T09:34:41.201801Z  INFO building yew-example
   Compiling turf_internals v0.3.0
error[E0308]: mismatched types
  --> /Users/xeho91/.cargo/registry/src/index.crates.io-6f17d22bba15001f/turf_internals-0.3.0/src/settings.rs:28:22
   |
28 | ...s: val.browser_targets.map(From::<BrowserVersions>::from),
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Targets`, found `Option<_>`
   |
   = note: expected struct `Targets`
                found enum `std::option::Option<_>`
help: call `Into::into` on this expression to convert `std::option::Option<_>` into `Targets`
   |
28 |             targets: val.browser_targets.map(From::<BrowserVersions>::from).into(),
   |                                                                            +++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `turf_internals` (lib) due to previous error
2023-06-07T09:34:42.121589Z ERROR ❌ error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status
Error: error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status
myFavShrimp commented 1 year ago

Hey, Thank you for bringing this issue to my attention and creating a pr. I really appreciate your kind words. The crate was indeed intended as a CSS-modules-like solution for Rust. Maybe I should mention it somewhere :grin:

Your pr looks good and will be merged shortly

myFavShrimp commented 1 year ago

The issue should be fixed in the latest release on crates.io. Thanks again for your contribution :smile:

myFavShrimp commented 1 year ago

This problem originated from the specified lightningcss version "1.0.0-alpha.41", which matched the newer but incompatible version "1.0.0-alpha.42". This bug is fixed with release 0.3.2.