Skip to content

[Bug]: resolveId hook returning this.resolve result corrupts CJS/UMD default exports in split chunks #7805

@DreierF

Description

@DreierF

Reproduction link or steps

https://stackblitz.com/edit/rolldown-rolldown-starter-stackblitz-dwblmwfl

Run pnpm install && pnpm build:no-plugin && pnpm test to observe the expected behavior
Run pnpm install && pnpm build && pnpm test to observe the broken behavior

What is expected?

Calling resolve from a plugin (sonda in this case) should not influence the functionality of the bundled application.

What is actually happening?

Adding a plugin such as

{
      name: 'sonda-like-resolver',
      async resolveId(source, importer, options) {
        if (!importer) {
          return;
        }

        const resolved = await this.resolve(source, importer, {
          ...options,
          skipSelf: true,
        });

        return resolved;
      },
    }

breaks the application at runtime.

It fails with n is not a function

System Info

- Rolldown: 1.0.0-beta.59
- tinycolor2: 1.6.0
- Node: 24.12.0

Any additional comments?

Related Issues:

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions