File tree 2 files changed +14
-0
lines changed
packages/app/src/sandbox/eval
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export default function initialize() {
60
60
config : {
61
61
plugins : [
62
62
'@babel/plugin-transform-react-jsx-source' ,
63
+ '@babel/plugin-proposal-optional-chaining' ,
63
64
'transform-flow-strip-types' ,
64
65
'transform-destructuring' ,
65
66
'babel-plugin-macros' ,
Original file line number Diff line number Diff line change 2
2
import { flatten } from 'lodash-es' ;
3
3
import codeFrame from 'babel-code-frame' ;
4
4
import macrosPlugin from 'babel-plugin-macros' ;
5
+ import chainingPlugin from '@babel/plugin-proposal-optional-chaining' ;
5
6
6
7
import delay from '@codesandbox/common/lib/utils/delay' ;
7
8
@@ -622,6 +623,18 @@ self.addEventListener('message', async event => {
622
623
Babel . registerPlugin ( 'babel-plugin-macros' , macrosPlugin ) ;
623
624
}
624
625
626
+ console . log ( flattenedPlugins ) ;
627
+ if (
628
+ ( flattenedPlugins . indexOf ( 'proposal-optional-chaining' ) > - 1 ||
629
+ flattenedPlugins . indexOf ( '@babel/plugin-proposal-optional-chaining' ) >
630
+ - 1 ) &&
631
+ Object . keys ( Babel . availablePlugins ) . indexOf (
632
+ 'proposal-optional-chaining'
633
+ ) === - 1
634
+ ) {
635
+ Babel . registerPlugin ( 'proposal-optional-chaining' , chainingPlugin ) ;
636
+ }
637
+
625
638
if (
626
639
flattenedPlugins . indexOf ( 'transform-cx-jsx' ) > - 1 &&
627
640
Object . keys ( Babel . availablePlugins ) . indexOf ( 'transform-cx-jsx' ) === - 1
You can’t perform that action at this time.
0 commit comments