I have the files main.js
, a.js
and b.js
:
main.js
import { foo } from './a'
console.log(foo)
a.js
import objWithFoo from './b'
const bar = 24
export default { ...objWithFoo, bar }
b.js
const foo = 42
export default { foo }
When I ran main.js
using node -r esm main.js
it gave me this error:
SyntaxError: The requested module 'file:///app/a.js' does not provide an export named 'foo'
Question:
Why is it loosing the named export?