Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@formatjs/swc-plugin-experimental support for latest rspack@1.0.0 #4499

Closed
JSMD-maintainers opened this issue Aug 29, 2024 · 4 comments
Closed
Labels

Comments

@JSMD-maintainers
Copy link

Which package?

@formatjs/swc-plugin-experimental@0.4.0

Describe the bug

When using the plugin with the latest rspack release a build error occurs:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.44/src/impls/core/mod.rs:266:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  failed to invoke plugin: failed to invoke plugin on 'Some("/Users/lekoma/WebstormProjects/rspack-can-not-read-property-of-undefined/client/index.js")'

Caused by:
    0: failed to invoke `@formatjs/swc-plugin-experimental` as js transform plugin at @formatjs/swc-plugin-experimental
    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 https://swc.rs/docs/plugin/selecting-swc-core 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.
    2: RuntimeError: unreachable
Location: index.crates.io-6f17d22bba15001f/swc-0.284.1/src/plugin.rs:169

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

To Reproduce

Reproducible Steps/Repo

Steps to reproduce the behavior:

  1. Go to 'https://github.com/MarcoLeko/rspack-can-not-read-property-of-undefined'
  2. Execute npm ci
  3. Run npm run rspack:dev:server
  4. See error

Expected behavior

The build should successfully work

Desktop (please complete the following information):

System:
OS: macOS 14.6
CPU: (10) arm64 Apple M1 Pro
Memory: 2.32 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
pnpm: 9.7.0 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
bun: 1.1.12 - /opt/homebrew/bin/bun
Browsers:
Chrome: 128.0.6613.85
Safari: 17.6
npmPackages:
@rspack/cli: ^1.0.0 => 1.0.0
@rspack/core: ^1.0.0 => 1.0.0

Additional context

Add any other context about the problem here.

@mcshaman
Copy link

I think what needs to happen is the plugin needs to be recompiled to support the latest version of swc_core I too am running into this problem. I have been able to replicate this issue with a basic React site, plus:

  • @formatjs/swc-plugin-experimental@0.4.0
  • @swc/cli@0.4.1-nightly.20240914
  • @swc/core@1.7.28
  • react-intl@6.7.0
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.44/src/impls/core/mod.rs:266:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.289.0/src/plugin.rs:169:14:
failed to invoke plugin: failed to invoke plugin on 'Some("index.tsx")'

Caused by:
    0: failed to invoke `@formatjs/swc-plugin-experimental` as js transform plugin at @formatjs/swc-plugin-experimental
    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/0.115.0 for the list of the compatible versions.
                        
                       Build info: 
                           Date: 2024-09-24
                           Timestamp: 2024-09-24T11:34:42.825465000Z
                           
                       Version info: 
                           swc_plugin_runner: 0.115.0
                           Dependencies: anyhow 1.0.89,codspeed-criterion-compat 2.7.2,criterion 0.5.1,enumset 1.1.5,futures 0.3.30,once_cell 1.19.0,parking_lot 0.12.3,serde 1.0.210,serde_json 1.0.128,swc_atoms 1.0.0,swc_common 0.40.0,swc_css_ast 0.147.0,swc_css_parser 0.157.0,swc_ecma_ast 0.121.0,swc_ecma_loader 0.52.0,swc_ecma_parser 0.152.0,swc_ecma_visit 0.107.0,swc_malloc 0.5.11,swc_plugin_proxy 0.50.0,testing 0.42.0,tokio 1.40.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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to handle: failed to invoke plugin: failed to invoke plugin on 'Some("index.tsx")'

Caused by:
    0: failed to invoke `@formatjs/swc-plugin-experimental` as js transform plugin at @formatjs/swc-plugin-experimental
    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/0.115.0 for the list of the compatible versions.
                        
                       Build info: 
                           Date: 2024-09-24
                           Timestamp: 2024-09-24T11:34:42.825465000Z
                           
                       Version info: 
                           swc_plugin_runner: 0.115.0
                           Dependencies: anyhow 1.0.89,codspeed-criterion-compat 2.7.2,criterion 0.5.1,enumset 1.1.5,futures 0.3.30,once_cell 1.19.0,parking_lot 0.12.3,serde 1.0.210,serde_json 1.0.128,swc_atoms 1.0.0,swc_common 0.40.0,swc_css_ast 0.147.0,swc_css_parser 0.157.0,swc_ecma_ast 0.121.0,swc_ecma_loader 0.52.0,swc_ecma_parser 0.152.0,swc_ecma_visit 0.107.0,swc_malloc 0.5.11,swc_plugin_proxy 0.50.0,testing 0.42.0,tokio 1.40.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
Error: Failed to compile 1 file with swc.
    at Object.assertCompilationResult (/Users/timmclaren/Development/formatjs-swc-plugin-test/node_modules/@swc/cli/lib/swc/util.js:164:15)
    at files (/Users/timmclaren/Development/formatjs-swc-plugin-test/node_modules/@swc/cli/lib/swc/file.js:205:19)
    at async _default (/Users/timmclaren/Development/formatjs-swc-plugin-test/node_modules/@swc/cli/lib/swc/file.js:224:9)

If I drop my version of @swc/core back to 1.6.0 the @swc/cli completes without error.

@iwtem
Copy link

iwtem commented Sep 29, 2024

I met the same problem and expected to be solved.

@JSMD-maintainers
Copy link
Author

You guys freaking rock! Thank you!

Can someone be so kind and release a new minor version of @formatjs/swc-plugin-experimental? (:

@longlho
Copy link
Member

longlho commented Oct 10, 2024

released

@longlho longlho closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants