Skip to content

[Bug]: ESModulesLinkingError (module has no exports) since v2 #14127

Description

@Agritite

System Info

System: Windows 11 22631 x64

Details

See the reproducible example repo;

on rspack@1.7.11 it succeeds, but on rspack@2.0.4 it fails with

ESModulesLinkingError: export 'default' (imported as 'dayjs') was not found in 'dayjs' (module has no exports)

Note: ignore the repo name; the main branch was for a previous bug

Reproduce link

https://github.com/Agritite/rspack-10456-repro/tree/no-exports

Reproduce Steps

  1. pnpm run build
  2. see error
  3. downgrade rspack to 1.7.11 i.e.
pnpm remove @rspack/cli @rspack/core
pnpm add -D @rspack/cli@^1 @rspack/core@^1
  1. pnpm run build
  2. succeeds

Note: you can also change the target to node24.15 or electron41.6-renderer; both also makes rspack@2 succeed
i.e. only when target: "web" + rspack@2 = ESModulesLinkingError

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending triageThe issue/PR is currently untouched.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions