Skip to content

[Bug]: Default export of library is undefined in final build #8045

@natocTo

Description

@natocTo

System Info

System:
- OS: macOS 14.5
- CPU: (11) arm64 Apple M3 Pro
- Memory: 1.26 GB / 18.00 GB
- Shell: 5.9 - /bin/zsh

Binaries:
- Node: 20.15.1 - /opt/homebrew/bin/node
- Yarn: 1.22.22 - ~/Documents/GitHub/ui/node_modules/.bin/yarn
- npm: 10.2.3 - ~/Documents/GitHub/ui/node_modules/.bin/npm

Browsers:
- Chrome: 129.0.6668.89
- Safari: 17.5

Details

I am migration one library from Webpack do Rspack. Locally (dev) working great, I have a issue with final production build.

Related config:

library: { name: 'kbcApp', export: 'default', type: 'window' },

Related default library export:

export default {
  start: startApp,
  helpers,
};

Check final export from compilted files:
Image

There is "collision" in names - Z and default. I am not sure why it is Z in the object, but it is not reflected bellow.
The s.default return undefined, when I override it to s.Z it works as expected.

Am I doing something wrong?

Reproduce link

No response

Reproduce Steps

  1. build library with default export
  2. check final build if library is correctly assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending triageThe issue/PR is currently untouched.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions