wasm build uses old swc libraries?

I'm a Rust newbie, maybe I'm doing something wrong. I have everything building natively with the latest swc. However, when I try to build for wasm, it's giving errors that indicate it's still using the old API?
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
Compiling qwik-core v0.2.0 (/home/wmertens/Projects/qwik/packages/qwik/src/optimizer/core)
error[E0432]: unresolved imports `swc_ecmascript::parser::EsSyntax`, `swc_ecmascript::parser::TsSyntax`
--> /home/wmertens/Projects/qwik/packages/qwik/src/optimizer/core/src/parse.rs:34:30
|
34 | use swc_ecmascript::parser::{EsSyntax, PResult, Parser, StringInput, Syntax, TsSyntax};
| ^^^^^^^^ no `EsSyntax` in the root ^^^^^^^^ no `TsSyntax` in the root
|
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
Compiling qwik-core v0.2.0 (/home/wmertens/Projects/qwik/packages/qwik/src/optimizer/core)
error[E0432]: unresolved imports `swc_ecmascript::parser::EsSyntax`, `swc_ecmascript::parser::TsSyntax`
--> /home/wmertens/Projects/qwik/packages/qwik/src/optimizer/core/src/parse.rs:34:30
|
34 | use swc_ecmascript::parser::{EsSyntax, PResult, Parser, StringInput, Syntax, TsSyntax};
| ^^^^^^^^ no `EsSyntax` in the root ^^^^^^^^ no `TsSyntax` in the root
|
4 Replies
kdy1
kdy16mo ago
I think you need to run curl https://raw.githubusercontent.com/swc-project/swc/main/scripts/update-all-swc-crates.sh | bash -s
w00t
w00tOP6mo ago
Hmm, that upgraded several swc packages from .0 to .1, but now it no longer compiles:
Compiling swc_allocator v0.1.7
Compiling swc_atoms v0.6.7
Compiling sourcemap v8.0.1
Compiling swc_config v0.1.14
Compiling napi v2.16.8
Compiling swc_common v0.36.1
Compiling swc_ecma_ast v0.117.1
Compiling swc_fast_graph v0.24.0
Compiling swc_ecma_visit v0.103.2
Compiling swc_ecma_parser v0.148.1
Compiling swc_ecma_codegen v0.154.1
error[E0432]: unresolved import `swc_allocator::collections`
--> /home/wmertens/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_codegen-0.154.1/src/text_writer/basic_impl.rs:3:21
|
3 | use swc_allocator::{collections::FxHashSet, maybe::vec::Vec};
| ^^^^^^^^^^^ could not find `collections` in `swc_allocator`
Compiling swc_allocator v0.1.7
Compiling swc_atoms v0.6.7
Compiling sourcemap v8.0.1
Compiling swc_config v0.1.14
Compiling napi v2.16.8
Compiling swc_common v0.36.1
Compiling swc_ecma_ast v0.117.1
Compiling swc_fast_graph v0.24.0
Compiling swc_ecma_visit v0.103.2
Compiling swc_ecma_parser v0.148.1
Compiling swc_ecma_codegen v0.154.1
error[E0432]: unresolved import `swc_allocator::collections`
--> /home/wmertens/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_codegen-0.154.1/src/text_writer/basic_impl.rs:3:21
|
3 | use swc_allocator::{collections::FxHashSet, maybe::vec::Vec};
| ^^^^^^^^^^^ could not find `collections` in `swc_allocator`
kdy1
kdy16mo ago
I’ll fix this once I get home It should be fixed
w00t
w00tOP6mo ago
Thank you so much for your help, it works now! The wasm build was because the cargo workspace was misconfigured and it had old dependencies.

Did you find this page helpful?