Skip to content

[Bug]: multiple entries mode will compose duplicate files into each entries that imported that file #610

Open
@turnerguo

Description

Version

System:
    OS: macOS 14.6.1
  Browsers:
    Chrome Canary: 133.0.6917.0
    Edge: 131.0.2903.112
  npmPackages:
    @rslib/core: 0.2.0 => 0.2.0

Details

Assuming we have a library package like this:

// ./src
//   - common
//     - utils.ts
//   - components-a
//     - buttons-a.ts -> utils.ts
//   - components-b
//     - buttons-b.ts -> utils.ts

// rslib.config.ts
...
source: {
       entry: {
         index: ['./src/**', '!./**/__test__/**'],
       },
    },
...

after build the utils.ts file will compiled into both components-a and components-b, in vite it will automatically split utils.ts as a reusable file, this is actually truly expected.

Reproduce link

https://codepen.io/Justineo/pen/yLbxxOR

Reproduce Steps

execute rslib build

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions