swc-project / plugins

Plugins for swc, written in rust
Apache License 2.0
335 stars 56 forks source link

Update major version of `swc_core` for plugins at same time as `@swc/core` #359

Closed rakleed closed 3 weeks ago

rakleed commented 3 weeks ago

Please update the major version of swc_core for plugins simultaneously with @swc/core. I have now installed @swc/plugin-styled-components v4.0.0, but since it also expects swc_core version 4, it does not work with the current @swc/core v1.7.42, because it still has version 3 of core.

Error: 1: failed to run Wasm plugin transform. Please ensure the version ofswc_coreused by the plugin is compatible with the host runtime. See the documentation for compatibility information. If you are an author of the plugin, please updateswc_coreto the compatible version.

kdy1 commented 3 weeks ago

No it’s not possible. Use plugins.swc.rs

kdy1 commented 2 weeks ago

Wasm plugins are experimental

rakleed commented 2 weeks ago

@kdy1 I still get this error with @swc/plugin-styled-components@4.0.0 when upgrading to @swc/core@1.8.0 with swc_core@4.0.3. Here's the full log:

Log: ```log [plugin:vite:react-swc] failed to handle: failed to invoke plugin: failed to invoke plugin on 'Some("my-project/src/index.jsx")' Caused by: 0: failed to invoke `my-project/node_modules/@swc/plugin-styled-components/swc_plugin_styled_components.wasm` as js transform plugin at my-project/node_modules/@swc/plugin-styled-components/swc_plugin_styled_components.wasm 1: failed to run Wasm plugin transform. Please ensure the version of `swc_core` used by the plugin is compatible with the host runtime. See the documentation for compatibility information. If you are an author of the plugin, please update `swc_core` to the compatible version. Note that if you want to use the os features like filesystem, you need to use `wasi`. Wasm itself does not have concept of filesystem. https://swc.rs/docs/plugin/selecting-swc-core See https://plugins.swc.rs/versions/from-plugin-runner/3.0.0 for the list of the compatible versions. Build info: Date: 2024-11-04 Timestamp: 2024-11-04T01:54:05.821856000Z Version info: swc_plugin_runner: 3.0.0 Dependencies: anyhow 1.0.92,codspeed-criterion-compat 2.7.2,criterion 0.5.1,enumset 1.1.5,futures 0.3.31,once_cell 1.20.2,parking_lot 0.12.3,serde 1.0.214,serde_json 1.0.132,swc_atoms 2.0.0,swc_common 3.0.0,swc_css_ast 3.0.0,swc_css_parser 3.0.0,swc_ecma_ast 3.0.0,swc_ecma_loader 3.0.0,swc_ecma_parser 4.0.0,swc_ecma_visit 3.0.0,swc_malloc 1.0.0,swc_plugin_proxy 3.0.0,testing 3.0.0,tokio 1.41.0,tracing 0.1.40,vergen 9.0.1,virtual-fs 0.16.0,wasmer 4.3.7,wasmer-cache 4.3.7,wasmer-compiler-cranelift 4.3.7,wasmer-wasix 0.27.0 2: RuntimeError: unreachable ```

Although on https://plugins.swc.rs/versions/range/19 they are listed as compatible.

By the way, the link https://plugins.swc.rs/versions/from-plugin-runner/3.0.0 from the error message shows no information.

And initially I asked to simply release @swc/core simultaneously with the update of the swc_core dependency in plugins, since previously I always updated to the latest version of @swc/core and @swc/plugin-styled-components, and never encountered incompatibility, since before that you apparently updated the versions of swc_core simultaneously.

kdy1 commented 2 weeks ago

https://github.com/swc-project/swc/issues/9711