@@ -13,7 +13,7 @@ const banner = `/**
13
13
* (c) ${ new Date ( ) . getFullYear ( ) }
14
14
* - Declan de Wet
15
15
* - Sébastien Chopin (@Atinux)
16
- * - All the amazing contributors
16
+ * - All the amazing contributors
17
17
* @license MIT
18
18
*/
19
19
`
@@ -32,7 +32,8 @@ function rollupConfig({
32
32
}
33
33
}
34
34
35
- if ( ! config . output . format || config . output . format === 'umd' ) {
35
+ // keep simple polyfills when buble plugin is used for build
36
+ if ( plugins && plugins . some ( p => p . name === 'buble' ) ) {
36
37
replaceConfig . values = {
37
38
'const polyfill = process.env.NODE_ENV === \'test\'' : 'const polyfill = true' ,
38
39
}
@@ -49,65 +50,67 @@ function rollupConfig({
49
50
plugins : [
50
51
json ( ) ,
51
52
nodeResolve ( ) ,
53
+ commonjs ( ) ,
52
54
replace ( replaceConfig )
53
55
] . concat ( plugins ) ,
54
56
} )
55
57
}
56
58
57
59
export default [
58
60
// umd web build
59
- rollupConfig ( {
61
+ {
60
62
output : {
61
63
file : pkg . web ,
62
64
} ,
63
65
plugins : [
64
- commonjs ( ) ,
65
66
buble ( )
66
67
]
67
- } ) ,
68
+ } ,
68
69
// minimized umd web build
69
- rollupConfig ( {
70
+ {
70
71
output : {
71
72
file : pkg . web . replace ( '.js' , '.min.js' ) ,
72
73
} ,
73
74
plugins : [
74
- commonjs ( ) ,
75
75
buble ( ) ,
76
76
terser ( )
77
77
]
78
- } ) ,
78
+ } ,
79
79
// common js build
80
- rollupConfig ( {
80
+ {
81
81
input : 'src/index.js' ,
82
82
output : {
83
83
file : pkg . main ,
84
84
format : 'cjs'
85
85
} ,
86
86
plugins : [
87
- commonjs ( )
87
+ buble ( )
88
88
] ,
89
89
external : Object . keys ( pkg . dependencies )
90
- } ) ,
90
+ } ,
91
91
// esm build
92
- rollupConfig ( {
92
+ {
93
93
input : 'src/index.js' ,
94
94
output : {
95
95
file : pkg . web . replace ( '.js' , '.esm.js' ) ,
96
96
format : 'es'
97
97
} ,
98
+ plugins : [
99
+ buble ( )
100
+ ] ,
98
101
external : Object . keys ( pkg . dependencies )
99
- } ) ,
102
+ } ,
100
103
// browser esm build
101
- rollupConfig ( {
104
+ {
102
105
input : 'src/browser.js' ,
103
106
output : {
104
107
file : pkg . web . replace ( '.js' , '.esm.browser.js' ) ,
105
108
format : 'es'
106
109
} ,
107
110
external : Object . keys ( pkg . dependencies )
108
- } ) ,
111
+ } ,
109
112
// minimized browser esm build
110
- rollupConfig ( {
113
+ {
111
114
input : 'src/browser.js' ,
112
115
output : {
113
116
file : pkg . web . replace ( '.js' , '.esm.browser.min.js' ) ,
@@ -117,5 +120,5 @@ export default [
117
120
terser ( )
118
121
] ,
119
122
external : Object . keys ( pkg . dependencies )
120
- } )
121
- ]
123
+ }
124
+ ] . map ( rollupConfig )
0 commit comments