clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.65k stars 124 forks source link

SyntaxError: Unexpected token '??=' #449

Open NullVoxPopuli opened 1 year ago

NullVoxPopuli commented 1 year ago

Expected Behavior

This command works

../../node_modules/.pnpm/rollup@3.21.0/node_modules/rollup/dist/bin/rollup -c

This doesn't

clinic flame -- ../../node_modules/.pnpm/rollup@3.21.0/node_modules/rollup/dist/bin/rollup -c

I'm using this silly path because just running rollup -c uses a bash script, which is incompatible with clinic / node profilling.

Current Behavior

Error received:

[!] SyntaxError: Unexpected token '??='
    at Loader.moduleStrategy (internal/modules/esm/translators.js:149:18)

[    ] Analysing dataTarget subprocess error, code: 1
[==  ] Analysing data^C

Steps to Reproduce (for bugs)

  1. find a rollup project with a working build
  2. invoke the build with clinic
  3. observe error

Environment

❯ clinic -v
v12.1.0

❯ clinic flame -v
v12.1.1 (0x v5.5.0)

❯ node -v
v18.16.0

❯ npm -v
9.5.1
robross0606 commented 1 month ago

Getting same thing with graphql-yoga because it uses ||=. This seems like some type of ECMAscript version issue, but I'm not sure why.

2024-07-22T21:18:33.146Z [error]: uncaughtException: Unexpected token '||='
C:\Code\my-app\node_modules\graphql-yoga\cjs\error.js:122
        status ||= 200;
               ^^^

SyntaxError: Unexpected token '||='
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (C:\Code\my-app\node_modules\graphql-yoga\cjs\index.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)