Skip to content

Use root instead of cwd in native vite plugins #7027

@shulaoda

Description

@shulaoda

Problem

Several native Vite-related plugins inside Rolldown (e.g. HTML, CSS, asset plugins) currently rely on inputOptions.cwd when resolving paths or determining the project root.

However, in Vite’s semantics, root is the actual project root — used for locating index.html, resolving public files, determining the dev-server base directory, and defining the allowed filesystem scope.

When: process.cwd() !== viteConfig.root (which is very common in monorepos), these plugins may behave inconsistently compared to vite build, producing incorrect path resolution.

Future Direction

After this change, we can consider (if safe):

Allowing_ rolldown-vite to pass viteConfig.root as cwd to Rolldown.

But this requires further evaluation because bundler-level cwd affects import resolution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions