File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ function esmConfig() {
5858 resolveTS ( ) ,
5959 version ( ) ,
6060 resolvePackages ( exposedDependencies ( ) , hiddenDependencies ( ) ) ,
61+ pruneEmptyBundles ( ) ,
6162 ] ,
6263 } ;
6364}
@@ -443,7 +444,7 @@ function templateCompilerConfig() {
443444 } ) ;
444445 config . output . globals = ( id ) => {
445446 return `(() => {
446- try {
447+ try {
447448 return require('${ id } ');
448449 } catch (err) {
449450 return ${ externals [ id ] }
@@ -452,3 +453,16 @@ function templateCompilerConfig() {
452453 } ;
453454 return config ;
454455}
456+
457+ function pruneEmptyBundles ( ) {
458+ return {
459+ name : 'prune-empty-bundles' ,
460+ generateBundle ( options , bundles ) {
461+ for ( let [ key , bundle ] of Object . entries ( bundles ) ) {
462+ if ( bundle . code . trim ( ) === '' ) {
463+ delete bundles [ key ] ;
464+ }
465+ }
466+ } ,
467+ } ;
468+ }
You can’t perform that action at this time.
0 commit comments