Skip to content

[Bug]: changing the severity to error in onLog does not cause the build to throw #8640

@va2p53

Description

@va2p53

What problem does this feature solve?

We're migrating to Rolldown and Vite currently. We have strict policies regarding circular dependencies and previously relied on plugins for Webpack to throw errors and stop builds when they are detected. I found that while Rolldown has ability to emit console logs (requested here) for them it doesn't seem to be able to emit errors.
Plugins for Rollup and Vite can cover this, but they are finding circular dependencies where we don't see them both with Rolldown and with Webpack plugin, so there is worry that dependency resolve algos are too different.

Would be very nice to have ability to emit errors natively without overhead from plugins.

What does the proposed API look like?

I propose API akin to eslint rules - default action on boolean (silent or warning) and more detailed when exact value passed. So current behavior wouldn't break.

checks: {
  circularDependency: undefined | boolean | "none" | "warning" | "error",
},

On "Error" after all circular dependencies found (it looks like warning thrown only after whole bundle checked) error is thrown, breaking build, in console with list of all places where they are found and dependency chains. Example in Webpack circular-dependency-plugin , rollup rollup-plugin-circular-dependencies and Vite vite-plugin-circular-dependency.

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions