Skip to content

Commit

Permalink
Update _EDIT_ME.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Sep 18, 2024
1 parent f5a1c50 commit 9c63360
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion votes/initiateNewVote/_EDIT_ME.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ prBody: |
const foo = require('foo').default;
```
As you can see, for CommonJS consumers this will not be exactly equivalent. So the idea is that Node.js can take a marker from package authors to customize what `require(esm)` gets in this case. To keep `const foo = require('foo')` working, the two proposed markers are:
As you can see, for CommonJS consumers this will not be exactly equivalent. Since in ESM the default exports is a property of the name space, they need to access `.default` from the result returned by
`require(esm)`. So the idea is that Node.js can take a marker from package authors to directly customize what `require(esm)` returns in this case.
To keep `const foo = require('foo')` working, the two proposed markers are:
```js
export default function foo () { };
Expand Down

0 comments on commit 9c63360

Please sign in to comment.