1
- module . exports = ( rollupConfig ) => {
1
+ module . exports = function ( rollupConfig ) {
2
2
rollupConfig . input = {
3
3
index : 'packages/runtime-tools/src/index.ts' ,
4
4
runtime : 'packages/runtime-tools/src/runtime.ts' ,
@@ -7,23 +7,28 @@ module.exports = (rollupConfig) => {
7
7
'runtime-core' : 'packages/runtime-tools/src/runtime-core.ts' ,
8
8
} ;
9
9
10
- // Check if output is an array and add hoistTransitiveImports: false
11
10
if ( Array . isArray ( rollupConfig . output ) ) {
12
- rollupConfig . output = rollupConfig . output . map ( ( c ) => ( {
13
- ...c ,
14
- hoistTransitiveImports : false ,
15
- entryFileNames :
16
- c . format === 'cjs'
17
- ? c . entryFileNames . replace ( '.js' , '.cjs' )
18
- : c . entryFileNames ,
19
- chunkFileNames :
20
- c . format === 'cjs'
21
- ? c . chunkFileNames . replace ( '.js' , '.cjs' )
22
- : c . chunkFileNames ,
23
- } ) ) ;
11
+ rollupConfig . output = rollupConfig . output . map ( function ( c ) {
12
+ var outputConfig = Object . assign ( { } , c , {
13
+ hoistTransitiveImports : false ,
14
+ entryFileNames :
15
+ c . format === 'cjs'
16
+ ? c . entryFileNames . replace ( '.js' , '.cjs' )
17
+ : c . entryFileNames ,
18
+ chunkFileNames :
19
+ c . format === 'cjs'
20
+ ? c . chunkFileNames . replace ( '.js' , '.cjs' )
21
+ : c . chunkFileNames ,
22
+ } ) ;
23
+
24
+ if ( c . format === 'cjs' ) {
25
+ outputConfig . externalLiveBindings = false ;
26
+ }
27
+
28
+ return outputConfig ;
29
+ } ) ;
24
30
} else {
25
- rollupConfig . output = {
26
- ...rollupConfig . output ,
31
+ var outputConfig = Object . assign ( { } , rollupConfig . output , {
27
32
hoistTransitiveImports : false ,
28
33
entryFileNames :
29
34
rollupConfig . output . format === 'cjs'
@@ -33,7 +38,12 @@ module.exports = (rollupConfig) => {
33
38
rollupConfig . output . format === 'cjs'
34
39
? rollupConfig . output . chunkFileNames . replace ( '.js' , '.cjs' )
35
40
: rollupConfig . output . chunkFileNames ,
36
- } ;
41
+ } ) ;
42
+
43
+ if ( rollupConfig . output . format === 'cjs' ) {
44
+ outputConfig . externalLiveBindings = false ;
45
+ }
46
+ rollupConfig . output = outputConfig ;
37
47
}
38
48
39
49
return rollupConfig ;
0 commit comments