@@ -67,40 +67,43 @@ export class Bundler {
67
67
}
68
68
69
69
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 > ( )
73
73
74
74
entryMods . forEach ( ( { url, shared } ) => {
75
75
if ( shared ) {
76
76
if ( util . isLikelyHttpURL ( url ) ) {
77
- remoteEntries . push ( url )
77
+ remoteEntries . add ( url )
78
78
} else {
79
- sharedEntries . push ( url )
79
+ sharedEntries . add ( url )
80
80
}
81
81
} else {
82
- entries . push ( url )
82
+ entries . add ( url )
83
83
}
84
84
} )
85
85
86
86
await this . createPolyfillBundle ( )
87
87
await this . createBundleChunk (
88
88
'deps' ,
89
- remoteEntries ,
89
+ Array . from ( remoteEntries ) ,
90
90
[ ]
91
91
)
92
- if ( sharedEntries . length > 0 ) {
92
+ if ( sharedEntries . size > 0 ) {
93
93
await this . createBundleChunk (
94
94
'shared' ,
95
- sharedEntries ,
96
- remoteEntries
95
+ Array . from ( sharedEntries ) ,
96
+ Array . from ( remoteEntries )
97
97
)
98
98
}
99
99
for ( const url of entries ) {
100
100
await this . createBundleChunk (
101
101
trimModuleExt ( url ) ,
102
102
[ url ] ,
103
- [ remoteEntries , sharedEntries ] . flat ( )
103
+ [
104
+ Array . from ( remoteEntries ) ,
105
+ Array . from ( sharedEntries )
106
+ ] . flat ( )
104
107
)
105
108
}
106
109
await this . createMainJS ( )
@@ -300,7 +303,7 @@ interface Minify {
300
303
301
304
let terser : Minify | null = null
302
305
303
- async function minify ( code : string , ecma : number = 5 ) {
306
+ async function minify ( code : string , ecma : number = 2015 ) {
304
307
if ( terser === null ) {
305
308
const { minify
} = await import ( 'https://esm.sh/[email protected] ?no-check' )
306
309
terser = minify as Minify
0 commit comments