File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
packages/app/src/sandbox/eval Expand file tree Collapse file tree 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() {
6060 config : {
6161 plugins : [
6262 '@babel/plugin-transform-react-jsx-source' ,
63+ '@babel/plugin-proposal-optional-chaining' ,
6364 'transform-flow-strip-types' ,
6465 'transform-destructuring' ,
6566 'babel-plugin-macros' ,
Original file line number Diff line number Diff line change 22import { flatten } from 'lodash-es' ;
33import codeFrame from 'babel-code-frame' ;
44import macrosPlugin from 'babel-plugin-macros' ;
5+ import chainingPlugin from '@babel/plugin-proposal-optional-chaining' ;
56
67import delay from '@codesandbox/common/lib/utils/delay' ;
78
@@ -622,6 +623,18 @@ self.addEventListener('message', async event => {
622623 Babel . registerPlugin ( 'babel-plugin-macros' , macrosPlugin ) ;
623624 }
624625
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+
625638 if (
626639 flattenedPlugins . indexOf ( 'transform-cx-jsx' ) > - 1 &&
627640 Object . keys ( Babel . availablePlugins ) . indexOf ( 'transform-cx-jsx' ) === - 1
You can’t perform that action at this time.
0 commit comments