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

SWC Wasm Plugin #3589

Open
jantimon opened this issue May 10, 2022 · 92 comments
Open

SWC Wasm Plugin #3589

jantimon opened this issue May 10, 2022 · 92 comments

Comments

@jantimon
Copy link

Hi @longlho

maybe you saw that the next community likes formatjs a lot and for some it's kind of blocking that nextjs does not allow to use your SWC plugin:

vercel/next.js#30174 (comment)
vercel/next.js#35502
vercel/next.js#33698

Vercel has been asked several times about their plan about SWC plugins but unfortunately the only feedback is that they are still looking into it:

vercel/next.js#30212
vercel/next.js#34384

In the meantime SWC (the compiler used to replace Babel in NextJs) added experimental plugin support for a new API which is way faster than their previous plugin system and will replace the current plugin system:

swc-project/swc#3540

Right now @martindisch and me are porting some babel plugins and experimenting with a hacked @next/swc version on our quite large codebase to learn more about potential performance gains.
Because of the great demand we are considering to port FormatJs to a Rust SWC plugin.

But before we start we would love to hear your feedback first - so please let us know what you think about all that :)

@jantimon jantimon added the bug label May 10, 2022
@longlho
Copy link
Member

longlho commented May 11, 2022

the biggest amount of work would be to rewrite our ICU message parser in Rust, which we've tried and the performance difference is negligible so we dropped it

@martindisch
Copy link

Is that prototype code still available somewhere? I've never worked with the ICU spec myself and am wondering what that would look like.

@longlho
Copy link
Member

longlho commented May 19, 2022

cc @pyrocat101 ^^

@pyrocat101
Copy link
Member

pyrocat101 commented May 23, 2022

Was looking for the older parser implementation in Rust but unfortunately I think I might have deleted the repo from Github :(

Is that prototype code still available somewhere? I've never worked with the ICU spec myself and am wondering what that would look like.

The current JavaScript parser is actually ported from my earlier Rust implementation, with very similar program structure. If I were you, I would start extracting the existing test cases (message text, parser options, expected parser result) into serialized files that can be reused between the JS version and the Rust version, and then start modeling the Rust version after the JS version.

@martindisch
Copy link

Thanks, I think that's all the pointers we need. By the way, I'm happy to report that Vercel seems pretty close now to enabling SWC plugin support in Next.js itself.

On our side we're still considering whether we actually need to write this particular plugin or if our own tooling works as is. I'm going to close this issue until we know more, will reopen it if we go ahead.

@github-actions
Copy link

github-actions bot commented Jun 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jun 8, 2022
@jantimon
Copy link
Author

jantimon commented Jun 8, 2022

short update - next.js added WASM plugin support to their latest canary

@github-actions github-actions bot removed the Stale label Jun 9, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jun 24, 2022
@simontaisne
Copy link

Looks like Next.js v12.2.0 now supports SWC Plugins (experimental) 🎉

@github-actions github-actions bot removed the Stale label Jun 29, 2022
@aurelien-gaillard
Copy link

I tried

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

it lead to this error:

thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke `xxx/node_modules/@formatjs/swc-plugin/index.js` as js transform plugin at /xxx/node_modules/@formatjs/swc-plugin/index.js

Caused by:
    0: Cannot compile plugin binary
    1: WebAssembly translation error: Error when converting wat: expected `(`

for info, my current .babelrc is

{
  "presets": ["next/babel"],
  "plugins": [
    [
      "formatjs",
      {
        "idInterpolationPattern": "[sha512:contenthash:base64:6]",
        "ast": true
      }
    ]
  ]
}

Someone has a successfull implementation of the SWC plugin with Next.js ?

@jantimon
Copy link
Author

jantimon commented Jul 8, 2022

@aurelien-gaillard the current formatjs swc plugin is no longer compatible with the latest swc plugin system

for more details please read the comments above

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jul 24, 2022
@elado
Copy link

elado commented Jul 25, 2022

Not stale.

@github-actions github-actions bot removed the Stale label Jul 26, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Aug 11, 2022
@longlho longlho added pinned and removed Stale labels Aug 11, 2022
@longlho
Copy link
Member

longlho commented Aug 11, 2022

until someone provides a codesandbox or a repro repo I can't really look into this

@elado
Copy link

elado commented Aug 17, 2022

@longlho I believe this issue isn't reporting a bug in the existing plugin but rather asking for a new WASM plugin.

https://swc.rs/docs/plugin/ecmascript/getting-started

Next.js now supports this WASM plugins but doesn't support JS plugins like @formatjs/swc-plugins.

@longlho
Copy link
Member

longlho commented Aug 18, 2022

Right I get that but there seems to be reports that the current one doesn't work w/ next.js?

@martindisch
Copy link

Not that I'm aware of, at least not directly. Next.js will still fall back to using Babel in the presence of .babelrc or similar, so for the moment it's fine. Depends on for how long they'll keep supporting Babel.

@aurelien-gaillard
Copy link

@formatjs/swc-plugins is not working with next.js
The workaround is to use .babelrc, but the build time is 5x lower with babel than it would be with a swc plugin.

@elado
Copy link

elado commented Aug 18, 2022

@longlho true - Next.js SWC plugins only support WASM plugins and not JS plugins (in fact, there was never an option to customize swc-loader and set the plugin option on it).
It seems like SWC deprecated the JS plugins altogether, maybe because they are making compilation much slower. So there's essentially no way to connect @formatjs/swc-plugin inside Next.js.

@uonr
Copy link

uonr commented May 1, 2023

It's work! Thanks @pyrocat101 and @kdy1 for addressing this issue

However, it doesn't seem to be possible to transpile the code in transpilePackages yet, this should be a problem with nextjs and I will create a repository for reproduction.

Edit: vercel/next.js#43886

@TrustyTechSG
Copy link

It works now, thanks a lot. But I noticed one exception is using intl.formatMessage({ defaultMessage: "xx" }) within useMemo, in this case if not set ID, the require ID error will show, simply remove useMemo block and then it works again.

@jvmiert
Copy link

jvmiert commented May 2, 2023

It works now, thanks a lot. But I noticed one exception is using intl.formatMessage({ defaultMessage: "xx" }) within useMemo, in this case if not set ID, the require ID error will show, simply remove useMemo block and then it works again.

Using the FormattedMessage component inside a useMemo also causes an error:

Error: [@formatjs/intl] An `id` must be provided to format a message

Can confirm that removing useMemo fixes the issue.

@TrustyTechSG
Copy link

I further notice can't even put in a array to loop on, will also causing the missing id error.

<SomeComponent>
  {
    [<FormattedMessage default="Some message" />].map(...)
  }
</SomeComponent>

@longlho
Copy link
Member

longlho commented May 2, 2023

Do u have a repro codesandbox or something?

@TrustyTechSG
Copy link

Do u have a repro codesandbox or something?

Im trying on it, my original project is a Monorepo setup with many pacakges, FormatteedMesage been used from local dependency, not sure wether can reproduce it in Simple set up.

In my case I notice at least in my Monorepo project, fall back to use Babel plugin not only do not have all issue above but also even much faster than SWC, so I just switched back to use babel instead.

I think might because of Monorepo, from time to time I see this error during page navigation with SWC plugin (Babel also works all fine without any issue)

my-project:build: Error: failed to process Failed to free memory allocated in the plugin: RuntimeError { source: User(Exit(ExitCode::srch (error 71))), wasm_trace: [], native_trace: Some( 0: <unknown>

@jvmiert
Copy link

jvmiert commented May 3, 2023

Do u have a repro codesandbox or something?

Here's a repro: https://github.com/jvmiert/formatjs-swc-issue

On these lines: https://github.com/jvmiert/formatjs-swc-issue/blob/main/pages/index.tsx#L47

This breaks on Windows with: Error: [@formatjs/intl] An id must be provided to format a message.

I didn't test it yet on Linux.

@adam-boosted
Copy link

Thanks @pyrocat101 for helping me get this into a project that's using @vitejs/plugin-react-swc!

@longlho any chance of a major version bump on the officially sanctioned plugin (or event a next/alpha tag in npm?)

@longlho
Copy link
Member

longlho commented May 5, 2023

@pyrocat101 mind taking a look?

@pyrocat101
Copy link
Member

pyrocat101 commented May 8, 2023

@jvmiert I am inclined to believe that this is a bug in SWC's visitor. I took your example and added some logging to visit_mut_jsx_opening_element. The visitor only traversed the second FormattedElement.

My repro scratchpad is here: main...swcVisitorBugRepro3589

Running bazel test --test_output=all //packages/swc-plugin-experimental:plugin_test will print out all JSX opening element visited (the test will fail as expected), and only Hello, World #2! is visited.

Consider filing a bug upstream?

pyrocat101 added a commit that referenced this issue May 8, 2023
@jvmiert
Copy link

jvmiert commented May 11, 2023

Thank you for checking it out @pyrocat101! I will file an issue in the coming days. I'm not super familiar with SWC or Rust but will try nevertheless

@jvmiert
Copy link

jvmiert commented May 15, 2023

I took a look at your branch @pyrocat101. Please correct me if I'm wrong but I don't think this is an issue with SWC. The elements show up when you add the same logging to this function:

fn visit_mut_call_expr(&mut self, call_expr: &mut CallExpr) {

So I'm guessing the plugin is currently not yet properly processing JSX inside expressions? This is a little bit out of my depth but I might have a look at it when I have more time later this week.

@pyrocat101
Copy link
Member

@jvmiert Ah I figured it out. The original implementation missed a visit_mut_children_with and therefore the JSX nested inside a call expression was never visited. Will send a fix.

pyrocat101 added a commit that referenced this issue May 22, 2023
…all expression (#4111)

The original Rust implementation does not visit the children of the call expression, as was discovered in #3589 (comment). This PR fixes that.
@jvmiert
Copy link

jvmiert commented May 26, 2023

@jvmiert Ah I figured it out. The original implementation missed a visit_mut_children_with and therefore the JSX nested inside a call expression was never visited. Will send a fix.

Just wanted to share that this fixed all the issues I was seeing. Thanks for looking into this and fixing it, much appreciated.

unional pushed a commit to unional/formatjs that referenced this issue Jun 7, 2023
…swc 1.3.56 (formatjs#4090)

For formatjs#3589

Update `swc_core` Rust crate and the `swc` NPM package used in the Node.js test. This PR should fix the crash that are reported on the latest version of next.js.

I have tested the following combination:
- plugin built from this PR
- next 13.3.2
- swc 1.3.56
unional pushed a commit to unional/formatjs that referenced this issue Jun 7, 2023
…all expression (formatjs#4111)

The original Rust implementation does not visit the children of the call expression, as was discovered in formatjs#3589 (comment). This PR fixes that.
@imageck
Copy link

imageck commented Jun 9, 2023

@pyrocat101 does this mean we can now omit specifying IDs in a map() (for rendering a list of components) call?

@pyrocat101
Copy link
Member

@pyrocat101 does this mean we can now omit specifying IDs in a map() (for rendering a list of components) call?

That should be the case. Try out @formatjs/swc-plugin-experimental@0.3.7?

@fdecampredon
Copy link

fdecampredon commented Jun 12, 2023

Using the latest plugin and nextjs 13.4.5 I still get errors.
Am I doing something wrong ?

Here is my nextjs config :

/** @type {import('next').NextConfig} */
module.exports = {
  ...
  experimental: {
    swcPlugins: [
      [
        '@formatjs/swc-plugin-experimental',
        {
          removeDefaultMessage: process.env.NODE_ENV === 'production',
          idInterpolationPattern: '[sha1:contenthash:base64:6]',
        },
      ],
    ],
  },
};

And here are the errors :

- info Creating an optimized production build .thread 'thread 'thread 'thread '<unnamed><unnamed><unnamed><unnamed>' panicked at '' panicked at '' 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: LayoutErrorexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rs', ', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rsexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rs', ::external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266266266::::676726667:

67
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'thread 'thread '<unnamed><unnamed><unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/pages/_app.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable' panicked at '', failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bbathread '15001f/swc-0.261.35/src/plugin.rs<unnamed>' panicked at ':', ' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/pages/_document.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachablefailed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/app-router.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable152', ', /Users/runner/.cargo/registry/:/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs14:src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs
152::152note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
152::1414
:14

thread 'thread '<unnamed><unnamed>' panicked at 'thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutError' panicked at '', ', called `Result::unwrap()` on an `Err` value: LayoutErrorexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rsexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rs', ::external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs266:266:67:266:67

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
note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/static-generation-async-storage.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/error-boundary.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread 'thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/render-from-template-context.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', <unnamed>/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266:67
note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/layout-router.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266thread ':<unnamed>thread '' panicked at '67<unnamed>' panicked at '
called `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutErrornote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
', ', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rsexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rsthread '::266<unnamed>thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/request-async-storage.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
266' panicked at '::called `Result::unwrap()` on an `Err` value: LayoutError6767
', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
:266note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
:67thread '
<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/action-async-storage.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/static-generation-bailout.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/static-generation-searchparams-bailout-provider.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266:thread '67
<unnamed>thread 'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<unnamed>' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutErrorcalled `Result::unwrap()` on an `Err` value: LayoutError', ', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rsthread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/searchparams-bailout-proxy.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
:external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs266:266::6767

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/server/app-render/rsc/preloads.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/client/components/hooks-server-context.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread 'thread '<unnamed>' panicked at '<unnamed>called `Result::unwrap()` on an `Err` value: LayoutError' panicked at '', called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rsexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266::26667:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/src/app/[lang]/page.tsx")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/src/app/[lang]/layout.tsx")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:266:67
note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', thread '<unnamed>external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs' panicked at ':called `Result::unwrap()` on an `Err` value: LayoutError266', :67external/crate_index__rkyv-0.7.41/src/impls/core/mod.rsthread ':
<unnamed>note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
266' panicked at ':called `Result::unwrap()` on an `Err` value: LayoutError67', thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/src/middleware.ts")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
:266:67
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/esm/server/web/globals.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
note: 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("/Users/fdecampredon/workspace/azzapp/packages/web/node_modules/next/dist/esm/server/web/adapter.js")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread 'thread '<unnamed>' panicked at '<unnamed>thread 'called `Result::unwrap()` on an `Err` value: LayoutError<unnamed>' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', ', called `Result::unwrap()` on an `Err` value: LayoutErrorexternal/crate_index__rkyv-0.7.41/src/impls/core/mod.rs', external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs:external/crate_index__rkyv-0.7.41/src/impls/core/mod.rs266:::266266::676767


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
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/src/app/api/logout/route.ts")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/src/app/api/changePassword/route.ts")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/fdecampredon/workspace/azzapp/packages/web/src/app/api/graphql/route.ts")'

Caused by:
    0: failed to invoke `/Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /Users/fdecampredon/workspace/azzapp/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.261.35/src/plugin.rs:152:14
error Command failed with signal "SIGBUS".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@pyrocat101
Copy link
Member

@fdecampredon See #3589 (comment)

0.3.7 is built against swc_core 0.75.42, so the supported nextjs version is here: https://swc.rs/docs/plugin/selecting-swc-core#v075x

@fdecampredon
Copy link

After decreasing the next version to 13.4.2, I got this error :

 info Using tsconfig file: ./tsconfig.next.json
- info Creating an optimized production build ...thread '<unnamed>' panicked at 'Failed to free memory allocated in the plugin: RuntimeError { source: User(Exit(ExitCode::srch (error 71))), wasm_trace: [], native_trace: Some(   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
) }', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_plugin_runner-0.94.19/src/transform_executor.rs:233:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Failed to compile.

../../node_modules/@formatjs/icu-messageformat-parser/parser.js
Error: failed to process Failed to free memory allocated in the plugin: RuntimeError { source: User(Exit(ExitCode::srch (error 71))), wasm_trace: [], native_trace: Some(   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
) }

Import trace for requested module:
../../node_modules/@formatjs/icu-messageformat-parser/parser.js
../../node_modules/@formatjs/icu-messageformat-parser/index.js
../../node_modules/@formatjs/intl/src/message.js
../../node_modules/@formatjs/intl/index.js
./src/helpers/i18nHelpers.ts
./src/app/[lang]/page.tsx

@imageck
Copy link

imageck commented Jun 14, 2023

That should be the case. Try out @formatjs/swc-plugin-experimental@0.3.7?

It's been working alright so far, which is wonderful! Sorry I just wanted a bit of confirmation. Thank you!

@jpomykala
Copy link
Contributor

I tried to make a fresh project with:

  • next@13.4.2 version (I tested couple others)
  • @formatjs/swc-plugin-experimental@0.3.7

and config:

const nextConfig = {
    experimental: {
        swcPlugins: [
            [
                '@formatjs/swc-plugin-experimental',
            ],
        ]
    }
}

and I'm still getting this error:

- error Error: Cannot find module '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/.next/fallback-build-manifest.json'
Require stack:
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/load-components.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/lib/render-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/require-hook.js:189:36
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at loadDefaultErrorComponentsImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/load-components.js:40:24)
    at DevServer.getFallbackErrorComponents (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js:1315:73)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async DevServer.renderErrorToResponseImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:1595:40)
    at async DevServer.pipeImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:642:25)
    at async Object.fn (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next-server.js:1145:21)
    at async Router.execute (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/router.js:315:32)
    at async DevServer.runImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:616:29)
    at async DevServer.run (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js:922:20)
    at async DevServer.handleRequestImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:547:20) {
  digest: undefined
}
Error: Cannot find module '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/.next/fallback-build-manifest.json'
Require stack:
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/load-components.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/lib/render-server.js
- /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at /Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/require-hook.js:189:36
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at loadDefaultErrorComponentsImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/load-components.js:40:24)
    at DevServer.getFallbackErrorComponents (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js:1315:73)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async DevServer.renderErrorToResponseImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:1595:40)
    at async pipe.req.req (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:1461:30)
    at async DevServer.pipeImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:642:25)
    at async DevServer.run (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js:930:28)
    at async DevServer.handleRequestImpl (/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/base-server.js:547:20) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/load-components.js',
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next-server.js',
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/dev/next-dev-server.js',
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/next.js',
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/server/lib/render-server.js',
    '/Users/jpomykala/Workspace/next-formatjs-swc-plugin/node_modules/next/dist/compiled/jest-worker/processChild.js'
  ]
}

@erguotou520
Copy link

erguotou520 commented Jul 26, 2023

I noticed that @formatjs/swc-plugin-experimental@0.3.7 does not declare the version range of @swc/core, so I don't know which version it is compatible with. Currently, I am using @swc/core@1.3.71 installed via @vitejs/plugin-react-swc, and it's causing a runtime error:

[plugin:vite:react-swc] failed to handle: failed to invoke plugin: failed to invoke plugin on 'Some("/web-next/src/App.tsx")'

Caused by:
    0: failed to invoke `/web-next/node_modules/.pnpm/@formatjs+swc-plugin-experimental@0.3.7/node_modules/@formatjs/swc-plugin-experimental/index.wasm` as js transform plugin at /web-next/node_modules/.pnpm/@formatjs+swc-plugin-experimental@0.3.7/node_modules/@formatjs/swc-plugin-experimental/index.wasm
    1: RuntimeError: unreachable
           at __rust_start_panic (<module>[22596]:0x773555)
           at rust_panic (<module>[22592]:0x773328)
           at std::panicking::rust_panic_with_hook::h6d84c9448306d839 (<module>[22591]:0x7732f7)
           at std::panicking::begin_panic_handler::{{closure}}::hd63a5a2e775785ab (<module>[22578]:0x772498)
           at std::sys_common::backtrace::__rust_end_short_backtrace::h01a301108fc5d2e6 (<module>[22577]:0x7723c5)
           at rust_begin_unwind (<module>[22586]:0x772b9a)
           at core::panicking::panic_fmt::h3c051bd1fa34c0ac (<module>[22681]:0x779319)
           at core::result::unwrap_failed::h454d05390f59f22d (<module>[22745]:0x781194)
           at core::result::Result<T,E>::unwrap::h9966f3e5f370392d (<module>[15619]:0x5cf35d)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::hfc82d33993bfa6f3 (<module>[2932]:0x117e12)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::hfae870412a073934 (<module>[3455]:0x15594e)
           at swc_ecma_ast::decl::_::<impl rkyv::Deserialize<swc_ecma_ast::decl::VarDecl,__D> for <swc_ecma_ast::decl::VarDecl as rkyv::Archive>::Archived>::deserialize::hd81b5ebc9d7f3634 (<module>[2812]:0x1108cc)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<T,D> for <T as rkyv::Archive>::Archived>::deserialize_unsized::h647b50e6b571e26e (<module>[2924]:0x11636d)
           at rkyv::impls::alloc::boxed::<impl rkyv::Deserialize<alloc::boxed::Box<T>,D> for rkyv::boxed::ArchivedBox<<T as rkyv::ArchiveUnsized>::Archived>>::deserialize::hf7cc2e450b5eee0f (<module>[3476]:0x1583ad)
           at swc_ecma_ast::decl::_::<impl rkyv::Deserialize<swc_ecma_ast::decl::Decl,__D> for <swc_ecma_ast::decl::Decl as rkyv::Archive>::Archived>::deserialize::h032263324f757b7d (<module>[2809]:0x10f2a0)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h59c8ca2170fd2121 (<module>[5293]:0x2149a6)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::h34451c0926912a14 (<module>[5631]:0x23a2f3)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h41480a5cfc56ae54 (<module>[3434]:0x1529e4)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::BlockStmt,__D> for <swc_ecma_ast::stmt::BlockStmt as rkyv::Archive>::Archived>::deserialize::h874f9ef17e26d914 (<module>[5294]:0x217f3c)
           at rkyv::impls::core::option::<impl rkyv::Deserialize<core::option::Option<T>,D> for rkyv::option::ArchivedOption<<T as rkyv::Archive>::Archived>>::deserialize::hd434bbb84a661c21 (<module>[1831]:0xb4eca)
           at swc_ecma_ast::function::_::<impl rkyv::Deserialize<swc_ecma_ast::function::Function,__D> for <swc_ecma_ast::function::Function as rkyv::Archive>::Archived>::deserialize::h8027a8cecd03ba38 (<module>[3084]:0x135a42)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<T,D> for <T as rkyv::Archive>::Archived>::deserialize_unsized::hb780ad2c31749b63 (<module>[3410]:0x150059)
           at rkyv::impls::alloc::boxed::<impl rkyv::Deserialize<alloc::boxed::Box<T>,D> for rkyv::boxed::ArchivedBox<<T as rkyv::ArchiveUnsized>::Archived>>::deserialize::h23931f901f4fa8de (<module>[3054]:0x12c411)
           at swc_ecma_ast::decl::_::<impl rkyv::Deserialize<swc_ecma_ast::decl::FnDecl,__D> for <swc_ecma_ast::decl::FnDecl as rkyv::Archive>::Archived>::deserialize::h181cfdbf3b3bda10 (<module>[2811]:0x11043b)
           at swc_ecma_ast::decl::_::<impl rkyv::Deserialize<swc_ecma_ast::decl::Decl,__D> for <swc_ecma_ast::decl::Decl as rkyv::Archive>::Archived>::deserialize::h032263324f757b7d (<module>[2809]:0x10f27b)
           at swc_ecma_ast::stmt::_::<impl rkyv::Deserialize<swc_ecma_ast::stmt::Stmt,__D> for <swc_ecma_ast::stmt::Stmt as rkyv::Archive>::Archived>::deserialize::h59c8ca2170fd2121 (<module>[5293]:0x2149a6)
           at swc_ecma_ast::module::_::<impl rkyv::Deserialize<swc_ecma_ast::module::ModuleItem,__D> for <swc_ecma_ast::module::ModuleItem as rkyv::Archive>::Archived>::deserialize::h1ba5ec449e8313a2 (<module>[1499]:0xa8176)
           at rkyv::impls::core::<impl rkyv::DeserializeUnsized<[U],D> for [T]>::deserialize_unsized::h4fee45d7ed343270 (<module>[1838]:0xb8f91)
           at rkyv::impls::alloc::vec::<impl rkyv::Deserialize<alloc::vec::Vec<T>,D> for rkyv::vec::ArchivedVec<<T as rkyv::Archive>::Archived>>::deserialize::h2e5803dbe8365d67 (<module>[3433]:0x1527a2)
           at swc_ecma_ast::module::_::<impl rkyv::Deserialize<swc_ecma_ast::module::Module,__D> for <swc_ecma_ast::module::Module as rkyv::Archive>::Archived>::deserialize::h29ccb482ad766188 (<module>[1495]:0xa7030)
           at swc_ecma_ast::module::_::<impl rkyv::Deserialize<swc_ecma_ast::module::Program,__D> for <swc_ecma_ast::module::Program as rkyv::Archive>::Archived>::deserialize::hcda031aa32df0fda (<module>[1498]:0xa79f4)
           at swc_common::plugin::serialized::PluginSerializedBytes::deserialize::hae360e74101baf09 (<module>[3029]:0x124c8c)
           at swc_common::plugin::serialized::deserialize_from_ptr::ha2ae2a5a57cc3f0d (<module>[3027]:0x1241cb)
           at __transform_plugin_process_impl (<module>[2586]:0xf7eb1)
           at __transform_plugin_process_impl.command_export (<module>[22854]:0x788063)

@chriskrogh
Copy link

is this still being worked on / prioritized?

@govizlora
Copy link

I noticed that @formatjs/swc-plugin-experimental@0.3.7 does not declare the version range of @swc/core, so I don't know which version it is compatible with. Currently, I am using @swc/core@1.3.71 installed via @vitejs/plugin-react-swc, and it's causing a runtime error:

"@swc/core@1.3.56" works with @formatjs/swc-plugin-experimental@0.3.7. You could enforce the version with your package manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests