centos8: cargo add sqlx,dx serve have error: error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. #2633
zuijiaoghb
started this conversation in
General
Replies: 1 comment
-
With dioxus fullstack, dioxus compiles your app twice: once for the frontend with the web feature, once for the backend with the server feature. You need to make sqlx optional and enable it only in the server feature so it isn't included in the WASM client. See this example: https://github.com/DioxusLabs/dioxus/blob/main/packages/fullstack/examples/axum-auth/Cargo.toml#L18-L26 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
[root@cpzljc dzsyhp]# cargo add sqlx
Updating crates.io index
Adding sqlx v0.7.4 to dependencies.
Features:
+ any
+ json
+ macros
+ migrate
+ sqlx-macros
28 deactivated features
Updating crates.io index
[root@cpzljc dzsyhp]# dx serve --port 8081
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
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.15/src/lib.rs:342:9
|
342 | / compile_error!("the wasm*-unknown-unknown targets are not supported by
343 | | default, you may need to enable the "js" feature.
344 | | For more information see:
345 | | https://docs.rs/getrandom/#webassembly-support");
| |________________________________________________________________________^
error[E0433]: failed to resolve: use of undeclared crate or module
imp
--> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.15/src/lib.rs:398:9
|
398 | imp::getrandom_inner(dest)?;
| ^^^ use of undeclared crate or module
imp
For more information about this error, try
rustc --explain E0433
.error: could not compile
getrandom
(lib) due to 2 previous errorsError: 🚫 Serving project failed:
Caused by:
Build failed
Beta Was this translation helpful? Give feedback.
All reactions