kwonoj/swc-plugin-coverage-instrument

Eval and Type errors in next 13.1.3

Closed this issue · 5 comments

Builds OK, runs OK in dev, but when running with

yarn buid && yarn start

We get

Error [EvalError]: Code generation from strings disallowed for this context
    at <unknown> (evalmachine.<anonymous>:1640)
    at new Function (<anonymous>)
    at cov_15095427721239937021 (evalmachine.<anonymous>:1640:18)
    at 210 (evalmachine.<anonymous>:1706:1)
    at __webpack_require__ (evalmachine.<anonymous>:25:42)
    at 941 (evalmachine.<anonymous>:1305:19)
    at __webpack_require__ (evalmachine.<anonymous>:25:42)
    at __webpack_exec__ (evalmachine.<anonymous>:3068:48)
    at <unknown> (evalmachine.<anonymous>:3069:37)
    at webpackJsonpCallback (evalmachine.<anonymous>:146:39)
    at <unknown> (evalmachine.<anonymous>:1:61)
Error [TypeError]: Cannot redefine property: __import_unsupported
    at <unknown> (evalmachine.<anonymous>:1291)
    at Function.defineProperty (<anonymous>)
    at enhanceGlobals (evalmachine.<anonymous>:1291:12)
    at 941 (evalmachine.<anonymous>:1303:9)
    at __webpack_require__ (evalmachine.<anonymous>:25:42)
    at __webpack_exec__ (evalmachine.<anonymous>:3068:48)
    at <unknown> (evalmachine.<anonymous>:3069:37)
    at webpackJsonpCallback (evalmachine.<anonymous>:146:39)
    at <unknown> (evalmachine.<anonymous>:1:61)
    at Script.runInContext (node:vm:141:12)
    at runInContext (node:vm:291:6)

This feels quite similar to my issue: #200

What test runner are you using?

hect1c commented

I also get this issue on version 0.0.14 and using next-13.1.7-canary.11 I tried updating both to latest version but then this causes the following issues
image

hect1c commented

Sorry can you please explain why my comment was marked as off topic? I'm having the same issue posted here with swc-plugin-coverage-instrument version 0.0.14 and next 13.1.7-canary.11

kwonoj commented

@hect1c Your comment is about plugin crash, nothing related with original issue and you should use latest plugin / next.js.

kwonoj commented

Also, for the original issue please provide minimal reproducible code. Minimal in terms of using hello-world or similar examples doesn't involve complex pages.