-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a patch to playroom to test custom IIFE logic
- Loading branch information
1 parent
754e5f9
commit 2eee76b
Showing
3 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/playroom/src/utils/compileJsx.ts b/node_modules/playroom/src/utils/compileJsx.ts | ||
index dadea77..21a5852 100644 | ||
--- a/node_modules/playroom/src/utils/compileJsx.ts | ||
+++ b/node_modules/playroom/src/utils/compileJsx.ts | ||
@@ -1,7 +1,7 @@ | ||
import { transform } from '@babel/standalone'; | ||
|
||
export const compileJsx = (code: string) => | ||
- transform(`<React.Fragment>${code.trim() || ''}</React.Fragment>`, { | ||
+ transform(`<React.Fragment>{(() => {${code.trim() || ''}})()}</React.Fragment>`, { | ||
presets: ['react'], | ||
}).code; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters