diff --git a/packages/ses/scripts/hermesTransforms.js b/packages/ses/scripts/hermesTransforms.js index 033dce50e6..80849b5fef 100644 --- a/packages/ses/scripts/hermesTransforms.js +++ b/packages/ses/scripts/hermesTransforms.js @@ -17,6 +17,18 @@ const asyncArrowEliminator = { if (path.node.async) { let body = path.node.body; + const startLine = path.node.loc.start.line; + const endLine = path.node.loc.end.line; + + path.traverse({ + ThisExpression(innerPath) { + // throw path.buildCodeFrameError("..."); // https://github.com/babel/babel/issues/8617 + throw Error( + `${startLine}:${endLine} Hermes makeBundle transform doesn't support 'this' keyword in async arrow functions`, + ); + }, + }); + // In case it's a ()=>expression style arrow function if (!t.isBlockStatement(body)) { body = t.blockStatement([t.returnStatement(body)]);