@@ -68,20 +68,29 @@ const buildRuntime = async (platform) => {
6868 const entryPoint = getEntryPoint ( platform )
6969 const { outfileUnminified, outfileMinified } = getOutFiles ( platform )
7070
71+ const babelPlugin = babel ( {
72+ config : {
73+ presets : [
74+ [
75+ '@babel/preset-env' ,
76+ {
77+ targets : {
78+ ie : '11' , // target es5 -- for example, react-native's QuickJS does not support class
79+ } ,
80+ } ,
81+ ] ,
82+ '@babel/preset-typescript' ,
83+ ] ,
84+ } ,
85+ } )
7186 // Bundle and minify with esbuild
7287 await esbuild . build ( {
7388 entryPoints : [ entryPoint ] ,
7489 outfile : outfileMinified ,
7590 bundle : true ,
7691 minify : true ,
7792 banner : { js : getBanner ( entryPoint ) } ,
78- plugins : [
79- babel ( {
80- config : {
81- presets : [ '@babel/preset-env' , '@babel/preset-typescript' ] ,
82- } ,
83- } ) ,
84- ] ,
93+ plugins : [ babelPlugin ] ,
8594 } )
8695 console . log ( `wrote: ${ outfileMinified } ` )
8796
@@ -92,13 +101,7 @@ const buildRuntime = async (platform) => {
92101 bundle : true ,
93102 minify : false ,
94103 banner : { js : getBanner ( entryPoint ) } ,
95- plugins : [
96- babel ( {
97- config : {
98- presets : [ '@babel/preset-env' , '@babel/preset-typescript' ] ,
99- } ,
100- } ) ,
101- ] ,
104+ plugins : [ babelPlugin ] ,
102105 } )
103106 console . log ( `wrote: ${ outfileUnminified } ` )
104107}
0 commit comments