From 01b4fcca47eacfe852801a9b892e194e80806da8 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Fri, 28 Aug 2020 01:26:15 -0400 Subject: [PATCH] Throw invariant error --- .../src/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/babel-helper-builder-react-jsx-experimental/src/index.js b/packages/babel-helper-builder-react-jsx-experimental/src/index.js index 8d804c4c15e3..a6b03184180c 100644 --- a/packages/babel-helper-builder-react-jsx-experimental/src/index.js +++ b/packages/babel-helper-builder-react-jsx-experimental/src/index.js @@ -439,6 +439,13 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`, } function makeSource(path, state) { + const location = path.node.loc; + if (!location) { + throw path.buildCodeFrameError( + "invariant: `makeSource` cannot return source information for generated paths. This is likely a bug with `@babel/helper-builder-react-jsx-experimental`.", + ); + } + if (!state.fileNameIdentifier) { const { filename = "" } = state;