Skip to content

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

@timfish

Description

@timfish

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions