Skip to content

Commit

Permalink
In daily-react-hooks, prevent Babel from running its regenerator tran…
Browse files Browse the repository at this point in the history
…sform, avoiding the known [regenerator unsafe-eval issue](facebook/regenerator#378). As far as I could tell our code is not relying on `yield` or generator functions (`function*`), so this should be safe.

The build tool TSDX depends on Babel and the problematic transform. Fortunately, TSDX [supports](https://github.com/jaredpalmer/tsdx#babel) specifying a partial `.babelrc` which is automatically merged into its default Babel configuration. I sanity-checked that Babel `'preset-env'` option merging works as expected by adding logging to TSDX.

This is the same fix we already applied to daily-js and the call machine in [this commit](daily-co/pluot-core@a98e54b).
  • Loading branch information
kompfner committed Jul 29, 2022
1 parent a5e4b61 commit 7e77a43
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
[
"@babel/preset-env",
{ "exclude": ["transform-regenerator"] }
]
]
}

0 comments on commit 7e77a43

Please sign in to comment.