Skip to content

[Bug]: Rolldown fails to bundle CJS files into IIFE format #8670

@condorheroblog

Description

@condorheroblog

Reproduction link or steps

I've been using Vite < 7 to bundle the path-to-regexp library into IIFE format in my code, see the implementation here: https://github.com/condorheroblog/vite-plugin-fake-server/blob/v2.2.2/packages/vite-plugin-fake-server/src/utils/buildPackage.ts

After upgrading to Vite@8, the bundled IIFE format is broken — the source code of path-to-regexp is output as-is without any proper transformation. I created a demo with Rolldown and confirmed this exact issue, check it here: https://stackblitz.com/edit/stackblitz-starters-m1kayetj?file=rolldown.config.mjs

For a simple custom function like sayHello, Rolldown bundles it into valid IIFE format correctly.

Image

But when bundling path-to-regexp, it just copies the source code directly without converting it to IIFE at all.

Image Image

Is this a misconfiguration on my side, or a bug with Rolldown?

What is expected?

Rolldown can bundle third-party libraries into IIFE format.

What is actually happening?

Rolldown fails to bundle third-party libraries into IIFE format.

System Info

"path-to-regexp": "^8.3.0",
"rolldown": "^1.0.0-rc.9"

Any additional comments?

No response

Metadata

Metadata

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions