Skip to content

Decide the behavior when .close is called without .generate / .write is called #6910

@sapphi-red

Description

@sapphi-red

This's a UB in Rollup. There's no way to only create a bundle in rollup without triggering the buildStart hook. For API like rollup(..)/watch(..), build stage hooks will surely be executed.

So for rollup, the quesion that "should we trigger closeBundle hook if there's no build/bundle happens" doesn't exist in the rollup world.

Notice: Bundler, unlike ClassicBundler, is designed for watch/dev mode.

I thought about making close bundle a bundler level hook, but it requires some significant change. Like this.resolve will be forbidden with closeBundle, though nobody use it this way.

Originally posted by @hyf0 in #6891 (comment)

Actually this also brings up question about how we gonna handle this in ClassicBundler?

"should we trigger closeBundle hook if there's no build/bundle happens"

Currently if you write

(await rolldown(..)).close()

closeBundle won't triggered in rolldown, while rollup will.

last_bundle_context: Option<BundleContext>,

Originally posted by @hyf0 in #6891 (comment)

We need to decide what to do for the first one and also document it (and fix the implementation if needed).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions