@@ -14,7 +14,7 @@ import bundleSize from 'rollup-plugin-bundle-size';
14
14
import pkg from './package.json' ;
15
15
16
16
// Our base plugins needed by every bundle type
17
- const plugins = [
17
+ let plugins = [
18
18
resolve ( ) , // so Rollup can find node modules
19
19
commonjs ( ) ,
20
20
json ( ) ,
@@ -23,32 +23,51 @@ const plugins = [
23
23
include : [ '**/*.wasm' ] ,
24
24
// Don't emit files, this will replace the worker build output
25
25
emitFiles : false
26
- } ) ,
27
- babel ( {
28
- // so Rollup can convert unsupported es6 code to es5
29
- exclude : [ 'node_modules/**' ] ,
30
- plugins : [ [ '@babel/plugin-proposal-class-properties' ] , [ '@babel/plugin-proposal-object-rest-spread' ] ]
31
- } ) ,
32
- bundleSize ( )
26
+ } )
33
27
] ;
34
28
29
+ if ( ! process . env . ES_NEXT ) {
30
+ plugins = [
31
+ ...plugins ,
32
+ babel ( {
33
+ // so Rollup can convert unsupported es6 code to es5
34
+ exclude : [ 'node_modules/**' ] ,
35
+ plugins : [ [ '@babel/plugin-proposal-class-properties' ] , [ '@babel/plugin-proposal-object-rest-spread' ] ]
36
+ } )
37
+ ] ;
38
+ }
39
+
40
+ plugins = [ ...plugins , bundleSize ( ) ] ;
41
+
35
42
// Array of bundles to make
36
43
const bundleMap = [ ] ;
37
44
38
45
if ( process . env . WASM ) {
39
- bundleMap . push ( {
46
+ let bundleMapObject = {
40
47
name : 'WasmBoyWasmCore' ,
41
48
input : 'core/portable/getWasmCore.js' ,
42
49
output : 'dist/core/getWasmBoyWasmCore'
43
- } ) ;
50
+ } ;
51
+
52
+ if ( process . env . ES_NEXT ) {
53
+ bundleMapObject . output = 'dist/core/getWasmBoyWasmCore.esnext' ;
54
+ }
55
+
56
+ bundleMap . push ( bundleMapObject ) ;
44
57
}
45
58
46
59
if ( process . env . TS ) {
47
- bundleMap . push ( {
60
+ let bundleMapObject = {
48
61
name : 'WasmBoyTsCore' ,
49
62
input : 'core/portable/getTsCore.js' ,
50
63
output : 'dist/core/getWasmBoyTsCore'
51
- } ) ;
64
+ } ;
65
+
66
+ if ( process . env . ES_NEXT ) {
67
+ bundleMapObject . output = 'dist/core/getWasmBoyTsCore.esnext' ;
68
+ }
69
+
70
+ bundleMap . push ( bundleMapObject ) ;
52
71
}
53
72
54
73
const getCoreBundles = [ ] ;
0 commit comments