Retsam19
SDSWC Developers
•Created by Retsam19 on 11/18/2024 in #questions
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.9 replies