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

Doesn't work with nextjs@12 compiler #7

Closed
thekip opened this issue Jan 11, 2023 · 5 comments
Closed

Doesn't work with nextjs@12 compiler #7

thekip opened this issue Jan 11, 2023 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@thekip
Copy link
Collaborator

thekip commented Jan 11, 2023

next.config.js

  experimental: {
    swcPlugins: [
      ['@lingui/swc-plugin', {}],
    ],
  },

Receive error when build:

thread 'thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'thread '<unnamed><unnamed>thread '' panicked at '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', <unnamed>/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.226.26/src/plugin.rs' panicked at ':failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
    2: unreachable', 216/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.226.26/src/plugin.rs:failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: RuntimeError: unreachable
    2: unreachable14', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.226.26/src/plugin.rs::216216::1414

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/projects/client-react/pages/_app.page.tsx")'

Next.js v12.3.1
Plugin: 0.1.0

@thekip thekip added the bug Something isn't working label Jan 11, 2023
@thekip
Copy link
Collaborator Author

thekip commented Jan 11, 2023

It builds fine with nextjs 13. Probably plugin build with a newer version of SWC and causes versions mismatch

@thekip thekip changed the title Doesn't work with nextjs compiler Doesn't work with nextjs@12 compiler Jan 11, 2023
@andrii-bodnar andrii-bodnar added the help wanted Extra attention is needed label Jan 12, 2023
@flowsni
Copy link

flowsni commented Jan 12, 2023

so we have to upgrade to nextjs13?
if yes, then we'll need to upgrade react->18 as well, but our project does not ready for this :)

@thekip
Copy link
Collaborator Author

thekip commented Jan 12, 2023

I'm trying to find a solution, but looks like swc plugins is so bleeding edge and api is very unstable

@thekip
Copy link
Collaborator Author

thekip commented Jan 17, 2023

Unfortunately, it seems that nextjs@12 and nextjs@13 has different plugin api, so supporting both is impossible.
So for nextjs@12 babel version is still a choice.

@thekip thekip closed this as completed Jan 17, 2023
@thekip
Copy link
Collaborator Author

thekip commented Jan 17, 2023

Related swc-project/swc#5060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants