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

Recommended version of swc_core #39702

Closed
1 task done
arlyon opened this issue Aug 17, 2022 · 4 comments
Closed
1 task done

Recommended version of swc_core #39702

arlyon opened this issue Aug 17, 2022 · 4 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@arlyon
Copy link

arlyon commented Aug 17, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri Jul 22 14:03:36 UTC 2022
Binaries:
  Node: 17.6.0
  npm: 8.5.1
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 12.2.6-canary.1
  eslint-config-next: 12.2.5
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Hi

I am working on creating an swc plugin and am attempting to set up a minimal example. In a bid to simplify versioning, swc has begun to package collections of packages under swc_core.

The problem is that no versions of swc_core work with next-swc yet. The issue is, either, what version of swc_core should I be using? or alternatively when do you plan to begin using swc_core?

Output is currently the following (next 12.2.6 canary 2 + swc_core 7.20)

❯ yarn dev
yarn run v1.22.17
warning ../../package.json: No license field
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn  - You have enabled experimental feature (swcPlugins) in next.config.js.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/client/next-dev.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versionsfailed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/pages/_app.tsx")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', ', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs::215:21514:
14note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/client/router.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/pages/_error.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/pages/_app.tsx")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/pages/_error.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/pages/_document.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.214.9/src/plugin.rs:215:14
error - ./node_modules/next/dist/client/dev/amp-dev.js
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/home/arlyon/Programming/twinswcro-test/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    Plugin runner cannot detect plugin's schema version. Ensure host is compiled with proper versions

Seems to be coming from here: https://github.com/swc-project/swc/blob/4a9b1dde1aaf84e233a9d1a59a1de539706e652b/crates/swc_plugin_runner/src/transform_executor.rs#L166-L169

Expected Behavior

That some version of swc_core will be advertised / supported

Link to reproduction

Difficult to create, since it depends on swc plugin

To Reproduce

Create a new plugin with swc_cli, build it for the wasm32_wasi target, and attempt to use it as a nextjs swc plugin.

@arlyon arlyon added the bug Issue was opened via the bug report template. label Aug 17, 2022
@arlyon
Copy link
Author

arlyon commented Aug 17, 2022

For the record, here is the combination of packages that I got working with next 12.5.6

[package]
edition = "2021"
name = "twinswcro"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
serde = "1"
swc_atoms = "0.3.1"
swc_common = "0.26.0"
swc_ecma_visit = "0.75.0"
swc_ecmascript = "0.186.0"
swc_plugin = "0.88.2"
swc_plugin_macro = "0.8.1"
tracing = "0.1.36"

[dev-dependencies]
swc_ecma_parser = {version = "0.116.0", features = ["typescript"]}
swc_ecma_transforms_testing = "0.104.0"

@kwonoj
Copy link
Contributor

kwonoj commented Aug 21, 2022

next-swc needs some time to keep up swc's upstream changes. Currently, next-swc does not incorporate swc_core as same as swc does, in result not able to handshake with plugins using swc_core. We expect to attemp to bump up next-swc to use swc_core soon, but that'll be on the canary release instead of public releases.

@samcx
Copy link
Member

samcx commented Feb 28, 2024

Closing since this was responded to!

@samcx samcx closed this as completed Feb 28, 2024
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

3 participants