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

support @swc/core@1.4.x #88

Closed
ouzhou opened this issue Apr 11, 2024 · 12 comments
Closed

support @swc/core@1.4.x #88

ouzhou opened this issue Apr 11, 2024 · 12 comments

Comments

@ouzhou
Copy link

ouzhou commented Apr 11, 2024

hi
1 hope to support @swc/core@1.4.x

2 maybe add dependencies in swc-plugin/package.json to lock version of swc ,like this

  "dependencies": {
    "@swc/core": "^1.3.107"
  }

rather than write this in package.json

  "resolutions": {
    "@swc/core": "1.3.105"
  },
image
@thekip
Copy link
Collaborator

thekip commented Apr 11, 2024

I don't build a version with a newer swc_core for a reason. I keep latest version of the plugin working with latest version of nextjs. Unfortunately, latest version of nextjs still sits within v0.82.x - v0.87.x

maybe add dependencies in swc-plugin/package.json to lock version of swc ,like this

it's not possible since they do not follow semver for now and range is open-ended. When they deploy a newer version i will not be able to "close" the range for already published package.

If you're blocked by this, you can build the plugin from sources and add a ready to use binary to your repository. Unfortunately, there is no better way to support all users for now.

@ouzhou
Copy link
Author

ouzhou commented Apr 11, 2024

@thekip
Copy link
Collaborator

thekip commented Apr 11, 2024

Cool, let's wait until they release it and i will bump plugin version

@semoal
Copy link

semoal commented Apr 11, 2024

Yep, just released mate
Opened a pull request: #89

@thekip
Copy link
Collaborator

thekip commented Apr 12, 2024

Still don't see it here https://swc.rs/docs/plugin/selecting-swc-core

@semoal
Copy link

semoal commented Apr 12, 2024

Still don't see it here swc.rs/docs/plugin/selecting-swc-core

Probably not updated yet, but Next 14.2 already uses 0.90.30 vercel/next.js#63790

@thekip
Copy link
Collaborator

thekip commented Apr 12, 2024

Couldn't be that sure

image

@semoal
Copy link

semoal commented Apr 12, 2024

It's curious because tried to upgrade to Next 14.2 and got this error when trying to run next dev or next build:

thread 'thread 'thread 'thread '<unnamed><unnamed>' panicked at '<unnamed>' panicked at '<unnamed>' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutError', ', ', called `Result::unwrap()` on an `Err` value: LayoutError/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs:', ::266266/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs266::::676726667

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

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '' panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.24/src/plugin.rs:thread '166' panicked at :/Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.24/src/plugin.rs:166:14:
failed to invoke plugin: failed to invoke plugin on 'Some("/x/.pnpm/next@14.2.0_@babel+core@7.23.5_@playwright+test@1.35.0_babel-plugin-macros@3.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/x/.pnpm/@lingui+swc-plugin@4.0.4_@lingui+macro@4.7.1_next@14.2.0/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /x/.pnpm/@lingui+swc-plugin@4.0.4_@lingui+macro@4.7.1_next@14.2.0/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: failed to run Wasm plugin transform. Please14:
failed to invoke plugin: failed to invoke plugin on 'Some("/x/.pnpm/next@14.2.0_@babel+core@7.23.5_@playwright+test@1.35.0_babel-plugin-macros@3.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/next-dev.js")'
``
`

@cbratschi
Copy link

It's curious because tried to upgrade to Next 14.2 and got this error when trying to run next dev or next build:

thread 'thread 'thread 'thread '<unnamed><unnamed>' panicked at '<unnamed>' panicked at '<unnamed>' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutError', ', ', called `Result::unwrap()` on an `Err` value: LayoutError/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs:', ::266266/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rkyv-0.7.42/src/impls/core/mod.rs266::::676726667

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

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '' panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.24/src/plugin.rs:thread '166' panicked at :/Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.24/src/plugin.rs:166:14:
failed to invoke plugin: failed to invoke plugin on 'Some("/x/.pnpm/next@14.2.0_@babel+core@7.23.5_@playwright+test@1.35.0_babel-plugin-macros@3.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/x/.pnpm/@lingui+swc-plugin@4.0.4_@lingui+macro@4.7.1_next@14.2.0/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm` as js transform plugin at /x/.pnpm/@lingui+swc-plugin@4.0.4_@lingui+macro@4.7.1_next@14.2.0/node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm
    1: failed to run Wasm plugin transform. Please14:
failed to invoke plugin: failed to invoke plugin on 'Some("/x/.pnpm/next@14.2.0_@babel+core@7.23.5_@playwright+test@1.35.0_babel-plugin-macros@3.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/next-dev.js")'
``
`

Same problem here. Next.js 14.2 fails to invoke node_modules/@lingui/swc-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm.

Downgrading Next.js until Lingui gets updated.

@thekip
Copy link
Collaborator

thekip commented Apr 15, 2024

@semoal did you try to run your locally built version with Next.js 14.2? Panic during plugin execution might be caused by many different things, swc_core version is only one of them. Rust version, compiler settings, internal bugs in next-swc all those things may commit into the issue.

I personally, prefer to wait until https://swc.rs/docs/plugin/selecting-swc-core would be updated (they usually have it up to date) and then start investigating.

@thekip
Copy link
Collaborator

thekip commented Apr 15, 2024

swc-project/swc#8862

@thekip
Copy link
Collaborator

thekip commented Apr 18, 2024

released https://github.com/lingui/swc-plugin/releases/tag/4.0.7

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

Successfully merging a pull request may close this issue.

4 participants