blitz-js / next-superjson-plugin

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

Nextjs Plugin Error #83

Closed isab closed 1 year ago

isab commented 1 year ago

Hello! I've just tried to install the Nextjs SWC Experimental Plugin but am getting a bunch of Failed to create plugin instance errors.

What I did:

yarn add superjson next-superjson-plugin

In my next.config.js:

const moduleExports = {
  reactStrictMode: true,
  swcMinify: true,
  output: "standalone",
  experimental: {
    swcPlugins: [["next-superjson-plugin", {}]],
  },
  sentry: {
    hideSourceMaps: true,
  },
};

const sentryWebpackPluginOptions = {
  silent: true,
};

module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions);

Errors I am receiving:

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("/Users/isabellee/Code/innacircle/sentry.client.config.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', ', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs222::22214:
14note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '
<unnamed>thread '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })<unnamed>', ' panicked at '/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rsfailed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/router.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] }):', 222/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs::14222
:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/pages/_app.jsx")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/pages/_error.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/sentry.server.config.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/pages/_app.jsx")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/pages/_error.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/pages/_document.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
error - ./sentry.client.config.js
Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/sentry.client.config.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })
wait  - compiling...
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/router.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/sentry.client.config.js")'

Caused by:
    0: Failed to create plugin instance
    1: Error while importing "env"."__set_transform_plugin_core_pkg_diagnostics": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [] })', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.212.1/src/plugin.rs:222:14
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/isabellee/Code/innacircle/pages/_error.js")'

Any help appreciated! Thanks!

bigsaigon333 commented 1 year ago

same issue on me

julianklumpers commented 1 year ago

Same issue here

Skn0tt commented 1 year ago

Hi! I'm pretty sure this is related to the superjson-swc plugin, moving the issue over there.

orionmiz commented 1 year ago

Please provide the version of Next.js and the version of next-superjson-plugin.

bigsaigon333 commented 1 year ago
    "next-superjson-plugin": "0.5.8",
    "next": "13.4.3",

Would you guys upgrade nextjs version to 13.4.3? I had no error on this version.

iEarlG commented 1 year ago

Same issue here

xDamneDx commented 1 year ago

I can confirm that upgrading 'next' from v13.4.2 to v13.4.3 - works. No more errors.