Skip to content

Duplicate exports from the same source file are incorrectly excluded  #171

@timfish

Description

@timfish

If a module has multiple exports with the same name, these do not get exported. This can occur when export * is used to merge exports from multiple files. However, if a duplicate named export actually comes from the same source file, it should be retained.

A simple example:
a.mjs

export const val = 1;

b.mjs

export * from './a.mjs';

c.mjs

export * from './a.mjs';
export * from './b.mjs';

When run in Node, c.mjs has a single export named val.
When running through import-in-the-middle there is no export.

This issues currently affects for the following libraries:

  • svelte
  • drizzle-orm

Using these libraries when they have been wrapped by import-in-the-middle results in errors like:

  • ReferenceError: X is not defined
  • The requested module 'M' does not provide an export named 'X'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions