Breaking with Next.js v13.2.4
sebkasanzew opened this issue ยท 8 comments
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.
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
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
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_oobHere 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
next.js uses different version to @swc/core
. Please wait until next.js have corresponding version.
@himself65 Next.js itself doesn't use it. It uses custom next-swc built on top of swc.
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
I can confirm that building works again with the following versions:
next: 13.3.5-canary.3
swc-plugin-coverage-instrument: 0.0.18