swc-plugin icon indicating copy to clipboard operation
swc-plugin copied to clipboard

Doesn't work with nextjs 13.1

Open timofei-iatsenko opened this issue 3 years ago • 9 comments

/**
 * @type {import('next').NextConfig}
 */
const config = {
  reactStrictMode: true,
  experimental: {
    swcPlugins: [
      ['@effector/swc-plugin', {}],
    ],
  },
}
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/k.mironov/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'thread 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228: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/tim/projects/timescenery/node_modules/next/dist/client/router.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/client/next-dev.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/k.mironov/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:36
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/tim/projects/timescenery/projects/client-react/pages/_app.page.tsx")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/k.mironov/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:36
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/tim/projects/timescenery/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LayoutError', /Users/k.mironov/.cargo/registry/src/github.com-1ecc6299db9ec823/rkyv-0.7.37/src/impls/core/mod.rs:265:36
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/tim/projects/timescenery/projects/client-react/pages/_document.page.tsx")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: call stack exhausted
    2: stk_ovf', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/projects/client-react/sentry.server.config.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/projects/client-react/pages/_app.page.tsx")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: out of bounds memory access
    2: heap_get_oob', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.236.14/src/plugin.rs:228:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/Users/tim/projects/timescenery/node_modules/next/dist/pages/_error.js")'

Caused by:
    0: failed to invoke `/Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm` as js transform plugin at /Users/tim/projects/timescenery/node_modules/@effector/swc-plugin/target/wasm32-wasi/release/effector_swc_plugin.wasm
    1: RuntimeError: out of bounds memory access

It's probably caused by a version mismatch between SWC version used in nextjs and SWC crates this plugin build with. Probably bumping to

swc_core = { version = "0.52.8", features = [".."] }

Should help

timofei-iatsenko avatar Jan 11 '23 14:01 timofei-iatsenko