Plugin panics when trying to read line number from SourceMapper
I've got a plugin where part of the logic involves reading the current line number:
This is working okay for tests, but I'm trying to run the plugin via the @swc/cli -
(The error message points me at https://plugins.swc.rs/versions/from-plugin-runner/4.0.0 but it's a dead link) And #2, I'm doing
npx swc /* input file */
and it's panicking:
I know it's the line_number lookup that's breaking it because I replace that with
let line_num = 0;
and it works.
The two things I'm seeing from the error are
1. swc_core
version issue or
2. wasi vs wasm issue
But for #1, I believe the versions I'm using are compatible:
* @swc/cli - 0.5.0
* @swc/core - 1.9.1
* swc_core - 4.0.3
* swc_plugin_runner - 4.0.0
And looking at the compat table, if I'm reading this right, the @swc/core
version is in range https://plugins.swc.rs/versions/range/19.(The error message points me at https://plugins.swc.rs/versions/from-plugin-runner/4.0.0 but it's a dead link) And #2, I'm doing
cargo build --target wasm32-wasip1
and pointing at target/wasm32-wasip1/debug/my_plugin.wasm
which seems like it should be the wasi version.Compat Range
Compat ranges for swc_core
8 Replies
If anyone can look at this, I've put it up on github with a script for reproducing it:
Or here's the full error as a text file
GitHub
[email protected]
and @swc/[email protected]
cannot run Wasm plugins that...Describe the bug Follow the reproduction at https://github.com/fpapado/swc-1.8.0-and-plugin-styled-components-4.0.0. Using @swc/[email protected] together with @swc/[email protected] and then...
@kdy1 I did see that issue, but wasn't that fixed in 1.9.0? I'm on 1.9.1 and still seeing a panic. (Also tried 1.9.3 just to be sure but still seeing it)
You are using wrong version of swc_core
Am I reading the compatibility table wrong? I selected the version of
@swc/core
and it showed swc_core @4.0.0 - *
so I thought 4.x was the right versionNo I forgot adding 5.x, but at least 4.x cannot work due to the issue
Okay, yeah, that seems to fix it. Thanks!