Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly named exports should be exported over export * exports #102

Closed
timfish opened this issue Jun 12, 2024 · 3 comments · Fixed by #103
Closed

Explicitly named exports should be exported over export * exports #102

timfish opened this issue Jun 12, 2024 · 3 comments · Fixed by #103

Comments

@timfish
Copy link
Contributor

timfish commented Jun 12, 2024

@mohd-akram and I incorrectly deduced that duplicate named exports resulted in those exports being excluded.

However, this is not always the case!

With the following code:
a.mjs

export function foo() { return 'a' }

b.mjs

export function foo() { return 'b' }

dupe.mjs

// the order here doesn't matter!
export * from './a.mjs'
export { foo } from './b.mjs'

test.mjs

import { foo } from './dupe.mjs'
console.log('out:', foo())
> node test.mjs
out: b

dupe.mjs should export foo from b.mjs. This is because explicitly named exports DO override export * exports.

@jsumners-nr
Copy link
Contributor

Nice.

It continues

image

@timfish
Copy link
Contributor Author

timfish commented Jun 12, 2024

It continues

Will it ever end!

@jsumners-nr
Copy link
Contributor

Will it ever end!

No. https://github.com/tc39/proposal-defer-import-eval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants