Skip to content

fix(config): close bundles when generation fails - #23256

Merged
bluwy merged 1 commit into
vitejs:mainfrom
NgoQuocViet2001:fix-config-bundle-close-on-error
Aug 21, 2026
Merged

fix(config): close bundles when generation fails#23256
bluwy merged 1 commit into
vitejs:mainfrom
NgoQuocViet2001:fix-config-bundle-close-on-error

Conversation

@NgoQuocViet2001

@NgoQuocViet2001 NgoQuocViet2001 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

bundleConfigFile closed its Rolldown bundle only after a successful generate() call. If config generation failed, the bundle remained open and its plugin/native resources were not finalized.

Close the config bundle in a finally block so both the successful and the failing generation path release it.

Validation

  • pnpm --filter vite typecheck
  • pnpm exec eslint packages/vite/src/node/config.ts
  • pnpm exec oxfmt --check packages/vite/src/node/config.ts

The regression test that was here originally has been dropped at review request — it needed mocking to force generate() to reject, and the fix is small enough not to warrant it.

Comment thread packages/vite/src/node/__tests__/configBundleClose.spec.ts Outdated
@NgoQuocViet2001
NgoQuocViet2001 force-pushed the fix-config-bundle-close-on-error branch from 73aa08d to 82bff6c Compare August 19, 2026 13:12
bundleConfigFile closed its Rolldown bundle only after a successful
generate() call. If config generation failed, the bundle stayed open and
its plugin and native resources were never finalized.

Close it in a finally block so both the successful and the failing path
release it.
@NgoQuocViet2001
NgoQuocViet2001 force-pushed the fix-config-bundle-close-on-error branch from 82bff6c to 7c2d5ef Compare August 20, 2026 08:58
@bluwy
bluwy merged commit 6bacc95 into vitejs:main Aug 21, 2026
19 checks passed
This was referenced Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants