You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a package.json file within packages with "type":"module", a js_binary will error on startup:
[Error[ERR_REQUIRE_ESM]: require()ofESModule/execroot/web/bazel-out/k8-opt-exec-ST-13d3ddad9198/bin/tools/tw-k8s-deployment-pipeline/bin-packaged__js_binary.sh.runfiles/aspect_rules_js/js/private/node-patches/register.jsnotsupported.register.jsistreatedasanESmodulefileasitisa.jsfilewhosenearestparentpackage.jsoncontains "type": "module" which declares all .js files in that package scope as ES modules.
Insteadrenameregister.jstoendin.cjs,changetherequiringcodetousedynamicimport()whichisavailableinallCommonJSmodules,orchange"type": "module"to"type": "commonjs"in/execroot/web/bazel-out/k8-opt-exec-ST-13d3ddad9198/bin/tools/tw-k8s-deployment-pipeline/package.jsontotreatall.jsfilesasCommonJS(using.mjsforallESmodulesinstead).
Fix is probably to use the .cjs extension for register.js
Version
Development (host) and target OS/architectures:
Output of bazel --version:
Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file:
Language(s) and/or frameworks involved:
How to reproduce
No response
Any other information?
No response
The text was updated successfully, but these errors were encountered:
What happened?
When using a package.json file within packages with
"type":"module"
, a js_binary will error on startup:Fix is probably to use the .cjs extension for register.js
Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
How to reproduce
No response
Any other information?
No response
The text was updated successfully, but these errors were encountered: