module: only try to enrich CJS syntax errors
It is guaranteed that V8 throws a syntax error when import
or export
is used outside of ESM.
Fixes: https://github.com/nodejs/node/issues/35687
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines