File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020 type OutputChunk ,
2121 type PluginContextMeta ,
2222 type RolldownOptions ,
23+ type RolldownOutput ,
2324 rolldown ,
2425} from 'rolldown'
2526import { isDynamicPattern } from 'tinyglobby'
@@ -2652,16 +2653,20 @@ export async function bundleConfigFile(
26522653 } ,
26532654 ] ,
26542655 } )
2655- const result = await bundle . generate ( {
2656- format : isESM ? 'esm' : 'cjs' ,
2657- sourcemap : 'inline' ,
2658- sourcemapPathTransform ( relative , sourcemapPath ) {
2659- return path . resolve ( path . dirname ( sourcemapPath ) , relative )
2660- } ,
2661- // we want to generate a single chunk like esbuild does with `splitting: false`
2662- codeSplitting : false ,
2663- } )
2664- await bundle . close ( )
2656+ let result : RolldownOutput
2657+ try {
2658+ result = await bundle . generate ( {
2659+ format : isESM ? 'esm' : 'cjs' ,
2660+ sourcemap : 'inline' ,
2661+ sourcemapPathTransform ( relative , sourcemapPath ) {
2662+ return path . resolve ( path . dirname ( sourcemapPath ) , relative )
2663+ } ,
2664+ // we want to generate a single chunk like esbuild does with `splitting: false`
2665+ codeSplitting : false ,
2666+ } )
2667+ } finally {
2668+ await bundle . close ( )
2669+ }
26652670
26662671 const entryChunk = result . output . find (
26672672 ( chunk ) : chunk is OutputChunk => chunk . type === 'chunk' && chunk . isEntry ,
You can’t perform that action at this time.
0 commit comments