@@ -67,40 +67,43 @@ export class Bundler {
6767 }
6868
6969 async bundle ( entryMods : Array < { url : string , shared : boolean } > ) {
70- const remoteEntries : Array < string > = [ ]
71- const sharedEntries : Array < string > = [ ]
72- const entries : Array < string > = [ ]
70+ const remoteEntries = new Set < string > ( )
71+ const sharedEntries = new Set < string > ( )
72+ const entries = new Set < string > ( )
7373
7474 entryMods . forEach ( ( { url, shared } ) => {
7575 if ( shared ) {
7676 if ( util . isLikelyHttpURL ( url ) ) {
77- remoteEntries . push ( url )
77+ remoteEntries . add ( url )
7878 } else {
79- sharedEntries . push ( url )
79+ sharedEntries . add ( url )
8080 }
8181 } else {
82- entries . push ( url )
82+ entries . add ( url )
8383 }
8484 } )
8585
8686 await this . createPolyfillBundle ( )
8787 await this . createBundleChunk (
8888 'deps' ,
89- remoteEntries ,
89+ Array . from ( remoteEntries ) ,
9090 [ ]
9191 )
92- if ( sharedEntries . length > 0 ) {
92+ if ( sharedEntries . size > 0 ) {
9393 await this . createBundleChunk (
9494 'shared' ,
95- sharedEntries ,
96- remoteEntries
95+ Array . from ( sharedEntries ) ,
96+ Array . from ( remoteEntries )
9797 )
9898 }
9999 for ( const url of entries ) {
100100 await this . createBundleChunk (
101101 trimModuleExt ( url ) ,
102102 [ url ] ,
103- [ remoteEntries , sharedEntries ] . flat ( )
103+ [
104+ Array . from ( remoteEntries ) ,
105+ Array . from ( sharedEntries )
106+ ] . flat ( )
104107 )
105108 }
106109 await this . createMainJS ( )
@@ -300,7 +303,7 @@ interface Minify {
300303
301304let terser : Minify | null = null
302305
303- async function minify ( code : string , ecma : number = 5 ) {
306+ async function minify ( code : string , ecma : number = 2015 ) {
304307 if ( terser === null ) {
305308 const { minify } = await import ( 'https://esm.sh/terser@5.6.1?no-check' )
306309 terser = minify as Minify
0 commit comments