Describe the bug
rustyscript v0.12.3 fails to build, giving a serde::__private import error. The issue is caused by a breaking change in serde that found itself upstream to deno_ast v0.49.0 which is the version pinned by rustyscript in its Cargo.toml.
Error:
error[E0432]: unresolved import `serde::__private`
--> swc_config-3.0.0\src\types\bool_or_data.rs:128:20
|
128 | use serde::__private::de;
| ^^^^^^^^^ could not find `__private` in `serde`
To Reproduce
Tested on both Windows and Ubuntu (via WSL2). Steps to reproduce the behavior:
- Create a new Rust project:
cargo new test-rustyscript && cd test-rustyscript
- Add rustyscript:
cargo add rustyscript --features fs_import,url_import
- Set environment variable to avoid NASM requirement (due to deno using the
aws-lc-rs crate, see here):
- Windows (PowerShell):
$env:AWS_LC_SYS_NO_ASM = "1"
- Linux/macOS (Bash):
export AWS_LC_SYS_NO_ASM=1
- Build:
cargo build
- See error (build fails with
serde::__private error)
Expected behavior
The project should build successfully without errors.
Root Cause
rustyscript's Cargo.toml (line 176) pins deno_ast = "=0.49.0", which depends on the broken swc_config v3.0.0.
rustyscript v0.12.3
└─ deno_ast v0.49.0 ← Pinned to exact version
└─ swc_config v3.0.0 ← Has serde::__private bug
The Fix
Change this line in rustyscript's Cargo.toml (line 176):
- deno_ast = { version = "=0.49.0", features = ["transpiling", "cjs"] }
+ deno_ast = { version = "0.50", features = ["transpiling", "cjs"] }
I tested it, and it compiles fine once deno_ast's version is bumped.
Why this works:
deno_ast v0.50+ uses swc_config v3.1.2 (which has the serde fix)
deno_ast v0.49.0 uses swc_config v3.0.0 (broken)
Describe the bug
rustyscript v0.12.3 fails to build, giving a
serde::__privateimport error. The issue is caused by a breaking change in serde that found itself upstream todeno_ast v0.49.0which is the version pinned byrustyscriptin itsCargo.toml.Error:
To Reproduce
Tested on both Windows and Ubuntu (via WSL2). Steps to reproduce the behavior:
cargo new test-rustyscript && cd test-rustyscriptcargo add rustyscript --features fs_import,url_importaws-lc-rscrate, see here):$env:AWS_LC_SYS_NO_ASM = "1"export AWS_LC_SYS_NO_ASM=1cargo buildserde::__privateerror)Expected behavior
The project should build successfully without errors.
Root Cause
rustyscript's
Cargo.toml(line 176) pinsdeno_ast = "=0.49.0", which depends on the brokenswc_config v3.0.0.The Fix
Change this line in rustyscript's
Cargo.toml(line 176):I tested it, and it compiles fine once
deno_ast's version is bumped.Why this works:
deno_ast v0.50+usesswc_config v3.1.2(which has the serde fix)deno_ast v0.49.0usesswc_config v3.0.0(broken)