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
node:internal/modules/esm/translators:178
if (!ObjectPrototypeHasOwnProperty(exports, exportName) ||
^
TypeError: Cannot convert undefined or null to object
at hasOwnProperty (<anonymous>)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:178:12)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Testcase Gist URL
No response
Additional Information
I was able to track this down and repro without ava as well (avajs/ava#3155). It appears you can no longer export null because it crashes the esm loader patch.
Prinzhorn
changed the title
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting anything that is not an object
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting null
Jan 20, 2023
Prinzhorn
changed the title
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting null
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting null/undefined
Jan 20, 2023
I think this is the culprit, because it assumes you can only export objects when in reality you can export anything.
Object.keys(module.exports)
Prinzhorn
changed the title
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting null/undefined
[Bug]: Regression: #35930 broke CJS via ESM loading when exporting null/undefined with ELECTRON_RUN_AS_NODE
Jan 20, 2023
It's not a module I control (as mentioned it comes from ci-parallel-vars which ava uses), hence I cannot not export null (which is perfectly valid code)
Yes, I downgraded to 21.1.0 which is the most recent version without the patch
Preflight Checklist
Electron Version
22.0.3
What operating system are you using?
Ubuntu
Operating System Version
Ubuntu 22.10
What arch are you using?
x64
Last Known Working Electron version
20.3.1 / 21.1.0
Expected Behavior
npm i electron@20.3.1 ava
ELECTRON_RUN_AS_NODE=true ./node_modules/.bin/electron ./node_modules/.bin/ava
I was successfully running my esm tests via
ELECTRON_RUN_AS_NODE
until nowActual Behavior
npm i electron@20.3.2 ava
ELECTRON_RUN_AS_NODE=true ./node_modules/.bin/electron ./node_modules/.bin/ava
Testcase Gist URL
No response
Additional Information
I was able to track this down and repro without ava as well (avajs/ava#3155). It appears you can no longer export
null
because it crashes the esm loader patch.index.mjs
module.cjs
ELECTRON_RUN_AS_NODE=true ./node_modules/.bin/electron index.mjs
It broke between
20.3.1
and20.3.2
because of #35930 . If you're curious, in ava this comes from this dep https://github.com/jamiebuilds/ci-parallel-vars/blob/994940e4882bdddf046a5c076b49d700449e4b38/index.js#L41-L56@MarshallOfSound fifth time is the charm
The text was updated successfully, but these errors were encountered: