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

Breaking with Next.js v13.2.4 #202

Closed
sebkasanzew opened this issue Mar 20, 2023 · 8 comments
Closed

Breaking with Next.js v13.2.4 #202

sebkasanzew opened this issue Mar 20, 2023 · 8 comments

Comments

@sebkasanzew
Copy link

I'm using this plugin with the experimental swcPlugins config from Next.js v13. So I'm not sure if this is an issue with this plugin or with the recent Next.js version.

Versions:
next - v13.2.4 (until v13.2.5-canary.8)
swc-plugin-coverage-instrument - v0.0.14

This is my config in next.config.mjs:

const nextConfig = {
  // ...

  experimental: {
    swcPlugins: [
      ['swc-plugin-coverage-instrument', {}],
    ]
  }

  // ...
}

yarn next build produces the following error:

error Command failed with signal "SIGBUS".

If needed, I can create a testing repository, where the error can be reproduced.

@sebkasanzew
Copy link
Author

It sill doesn't work with

next: 13.3.0
swc-plugin-coverage-instrument: 0.0.15

But the error is different now:

Segmentation fault

Here is a codesandbox, where the error can be reproduced:
https://codesandbox.io/p/sandbox/elated-shadow-e4e3v8

@sebkasanzew
Copy link
Author

New error after update:

next: 13.3.1
swc-plugin-coverage-instrument: 0.0.16

Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/workspace/pages/api/hello.ts")'

Caused by:
    0: failed to invoke `/workspace/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm` as js transform plugin at /workspace/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm
    1: RuntimeError: out of bounds memory access
           at <swc_plugin_proxy::source_map::plugin_source_map_proxy::PluginSourceMapProxy as swc_common::errors::SourceMapper>::lookup_char_pos::h828495e6c321b96a (<module>[98]:0x1f3ff)
           at swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S>::create_fn_instrumentation::h302a065be109ea7f (<module>[147]:0x3537d)
           at <swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S> as swc_ecma_visit::VisitMut>::visit_mut_fn_expr::hd4cf36078eeee94d (<module>[96]:0x1ea2f)
           at <swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S> as swc_ecma_visit::VisitMut>::visit_mut_module_items::he9e055cca9c71a27 (<module>[167]:0x39a05)
           at __transform_plugin_process_impl (<module>[1747]:0x1947a3)
           at __transform_plugin_process_impl.command_export (<module>[2437]:0x22f9b1)
    2: heap_get_oob

Here is a new codesandbox, where the error can be reproduced (run "build"):
https://codesandbox.io/p/sandbox/kwonoj-swc-plugin-coverage-instrument-issue-202-forked-zoko8w

@himself65
Copy link

New error after update:

next: 13.3.1 swc-plugin-coverage-instrument: 0.0.16

Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/workspace/pages/api/hello.ts")'

Caused by:
    0: failed to invoke `/workspace/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm` as js transform plugin at /workspace/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasi/release/swc_plugin_coverage.wasm
    1: RuntimeError: out of bounds memory access
           at <swc_plugin_proxy::source_map::plugin_source_map_proxy::PluginSourceMapProxy as swc_common::errors::SourceMapper>::lookup_char_pos::h828495e6c321b96a (<module>[98]:0x1f3ff)
           at swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S>::create_fn_instrumentation::h302a065be109ea7f (<module>[147]:0x3537d)
           at <swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S> as swc_ecma_visit::VisitMut>::visit_mut_fn_expr::hd4cf36078eeee94d (<module>[96]:0x1ea2f)
           at <swc_coverage_instrument::visitors::coverage_visitor::CoverageVisitor<C,S> as swc_ecma_visit::VisitMut>::visit_mut_module_items::he9e055cca9c71a27 (<module>[167]:0x39a05)
           at __transform_plugin_process_impl (<module>[1747]:0x1947a3)
           at __transform_plugin_process_impl.command_export (<module>[2437]:0x22f9b1)
    2: heap_get_oob

Here is a new codesandbox, where the error can be reproduced (run "build"): https://codesandbox.io/p/sandbox/kwonoj-swc-plugin-coverage-instrument-issue-202-forked-zoko8w

same for 0.0.17

@kwonoj
Copy link
Owner

kwonoj commented Apr 25, 2023

next.js uses different version to @swc/core. Please wait until next.js have corresponding version.

@kwonoj
Copy link
Owner

kwonoj commented Apr 25, 2023

@himself65 Next.js itself doesn't use it. It uses custom next-swc built on top of swc.

@kwonoj
Copy link
Owner

kwonoj commented May 2, 2023

Anyone report this should try LATEST version of next@canary and plugin.

https://codesandbox.io/p/sandbox/kwonoj-swc-plugin-coverage-instrument-issue-202-forked-plv7ur

@kwonoj kwonoj closed this as completed May 2, 2023
@sebkasanzew
Copy link
Author

I can confirm that building works again with the following versions:

next: 13.3.5-canary.3
swc-plugin-coverage-instrument: 0.0.18

https://codesandbox.io/p/sandbox/kwonoj-swc-plugin-coverage-instrument-issue-202-next-v13-3-1-forked-xee8r5

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

No branches or pull requests

3 participants