blitz-js / next-superjson-plugin

SuperJSON Plugin for Next.js Pages and Components
198 stars 13 forks source link

Missing export __get_transform_plugin_core_pkg_diag #28

Closed cellulosa closed 1 year ago

cellulosa commented 1 year ago

Describe the bug

When enabling the plugin the terminal returns:

thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../node_modules/next/dist/client/next-dev.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216: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/.../node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../node_modules/next/dist/client/router.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../src/pages/_app.tsx")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../node_modules/next/dist/pages/_error.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
thread 'thread '<unnamed>' panicked at '<unnamed>failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../src/pages/_app.tsx")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag' panicked at '', failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../src/pages/_document.tsx")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs', :/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216216::1414

thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/.../node_modules/next/dist/pages/_error.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216: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("/Users/.../node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    Missing export __get_transform_plugin_core_pkg_diag

Expected behavior

Not throw error

Reproduction link

No response

Version

0.4.1

Config

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  experimental: {
    swcPlugins: [['next-superjson-plugin', {}]],
  },
};

module.exports = nextConfig;

Additional context

Next 12.3.0

orionmiz commented 1 year ago

It seems to be an error from breaking changes of SWC (Found in here)

Fixing this error by updating the plugin was successful. However, when I tested the plugin in Next.js 12.3, another error message has come out

After doing some research, I found that the new error is also related to SWC. I will try to contact the maintainer of SWC as soon as possible.

Please wait for bringing a solution.

Thanks for reporting an issue!

cdbattags commented 1 year ago

Any update here? Eager to give this a try!

orionmiz commented 1 year ago

Plugin v0.4.2 is released!

Tested working on Next.js v12.3.1-canary.2 (It should be bigger than v12.3.0)

Try it!

boatmeme commented 1 year ago

Works great for me. Thank you @orionmiz!

rayandrew commented 1 year ago

Hi @orionmiz,

I still have problems with Macbook Air M2.

This is the only error message that I had when running next dev

Caused by:
    0: failed to invoke `/Users/rayandrew/Projects/web-monorepo/node_modules/.pnpm/next-superjson-plugin@0.4.2_vc747sktxxakxjmvmp76wxv6ju/node_modules/next-superjson-plugin/next_superjson.wasm` as js transform plugin at /Users/rayandrew/Projects/web-monorepo/node_modules/.pnpm/next-superjson-plugin@0.4.2_vc747sktxxakxjmvmp76wxv6ju/node_modules/next-superjson-plugin/next_superjson.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
orionmiz commented 1 year ago

@rayandrew

Found using old version of swc in the error logs:

2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.224.0/src/plugin.rs:216:14

Seems like you used the version of next.js lower than v12.3.1-canary.2

Don't forget v0.4.2 ensures working only over v12.3.0 (It means canary release currently)

You can update to the canary with this command:

pnpm add next@canary