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 in NextJS 13.2.4 #39

Closed
rwu823 opened this issue Mar 16, 2023 · 20 comments
Closed

Doesn't work in NextJS 13.2.4 #39

rwu823 opened this issue Mar 16, 2023 · 20 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@rwu823
Copy link

rwu823 commented Mar 16, 2023

Adding this swc plugin causes the next dev server to fail to start.

// next.config.js
  experimental: {
    swcPlugins: [['@lingui/swc-plugin', {}]],
  },

It is worked fine before upgrading Next.js

@andrii-bodnar
Copy link
Contributor

HI @rwu823,

could you please check the nextjs-13 example project? Is it reproducible on this project? If so, please share more details about the error and the steps to reproduce

@timofei-iatsenko
Copy link
Collaborator

i believe they simply bumped a bundled version of SWC, so now layout of AST is not compatible with current compiled version.

@rwu823
Copy link
Author

rwu823 commented Mar 16, 2023

@andrii-bodnar The nextjs-13 example doesn't upgrade to the latest next.

https://github.com/lingui/swc-plugin/blob/main/examples/nextjs-13/package.json#L20

 "next": "13.1.2",

Probably as @thekip said that AST is not compatible.

@khmm12
Copy link

khmm12 commented Mar 17, 2023

Yep, the plugin doesn't work with @swc/core >= 1.3.39.

@timofei-iatsenko
Copy link
Collaborator

FYI: SWC devs created a plugin compatibility page https://swc.rs/docs/plugin/selecting-swc-core

Unfortunately bumping a version of swc core did not resolve an issue. Continue to investigate

@vitorbertolucci
Copy link

I may be missing something but it seems that NextJS 13.2.4 is using @swc/core 1.2.203 (https://github.com/vercel/next.js/blob/v13.2.4/package.json) and the @lingui/swc-plugin is breaking it, so it is not only for @swc/core >= 1.3.39

@timofei-iatsenko
Copy link
Collaborator

Current stable version of the plugin compiled with swc_core "0.56.1" that according to Selecting swc_core

image

@timofei-iatsenko
Copy link
Collaborator

Do you guys know any custom SWC plugins which works with latest nextjs? I want to take it as an example.

@timofei-iatsenko
Copy link
Collaborator

For those who feel lucky and brave, i build plugin with latest (0.72.0) swc_core. It for some reason doesn't work on my machine, but maybe it depends on aarch would work on your machine. Or with plain SWC (not a next-swc)

lingui_macro_plugin.wasm.zip

How to use:

  • unpack
  • put file in your project
  • set full path to the wasm file in nextjs / swc config

@timofei-iatsenko
Copy link
Collaborator

FYI vercel/next.js#46989

@bigint
Copy link

bigint commented Apr 7, 2023

Screenshot 2023-04-07 at 3 57 44 PM

I'm getting this in my project 🙇🏼 any ideas how to fix

https://github.com/lensterxyz/lenster

@bigint
Copy link

bigint commented Apr 7, 2023

@timofei-iatsenko
Copy link
Collaborator

I'm getting this in my project 🙇🏼 any ideas how to fix

Downgrade to nextjs < 13.2.4
Latest next-swc has a bug, waiting this to be merged

@TimFL
Copy link

TimFL commented Apr 20, 2023

Looks like v13.3.1-canary.12 fixes this issue.

@timofei-iatsenko
Copy link
Collaborator

timofei-iatsenko commented Apr 20, 2023

@TimFL did you try the current version of a plugin with canary release, or just noticed that the fix was merged by nextjs team? I'm asking because whont to know should i rebuild plugin with latest swc-core to support v13.3.1-canary.12 or it works as is.

@TimFL
Copy link

TimFL commented Apr 20, 2023

@TimFL did you try the current version of a plugin with canary release, or just noticed that the fix was merged by nextjs team? I'm asking because whont to know should i rebuild plugin with latest swc-core to support v13.3.1-canary.12 or it works as is.

I'm sorry for the confusion, I meant: that release fixes the swc problems, but plugin devs have to update their libraries so they work again. This needs updating now.

@hehex9
Copy link

hehex9 commented Apr 20, 2023

I've tested the latest version of swc_core (0.75) with the newest next.js canary release, and I can confirm that the wasm file can be executed without any issues.

@timofei-iatsenko
Copy link
Collaborator

https://github.com/lingui/swc-plugin/pull/54/files

@timofei-iatsenko
Copy link
Collaborator

v4 is relased officially and it's already built with latest swc-core. Please see compatibility table in readme

@timofei-iatsenko
Copy link
Collaborator

@pawanrana1992 please read compatibility table carefully. The plugins indeed work with nextjs 13.*. You need to choose the right version of both. SWC plugins is experimental feature, they DO BREAK backward compatibility in patch and minor releases, so you need to choose an exact version of nextjs

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

8 participants