From 75a2f74418019819e0cdcb1e0720b0a5d0d65687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sat, 19 Feb 2022 14:53:33 +0100 Subject: [PATCH] Fixed a transpilation issue that caused `useInsertionEffect` to be referenced directly in the specifiers list of the import statement --- .changeset/dull-trees-crash.md | 6 ++++++ packages/react/src/global.js | 4 ++-- packages/react/src/useInsertionEffectMaybe.js | 6 +++--- packages/styled/src/useInsertionEffectMaybe.js | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .changeset/dull-trees-crash.md diff --git a/.changeset/dull-trees-crash.md b/.changeset/dull-trees-crash.md new file mode 100644 index 000000000..54db5d625 --- /dev/null +++ b/.changeset/dull-trees-crash.md @@ -0,0 +1,6 @@ +--- +'@emotion/react': patch +'@emotion/styled': patch +--- + +Fixed a transpilation issue that caused `useInsertionEffect` to be referenced directly in the specifiers list of the import statement. This has caused build errors in the consuming tools since the import statement can only reference known exports of a module. diff --git a/packages/react/src/global.js b/packages/react/src/global.js index 15f361e0d..fcfca2866 100644 --- a/packages/react/src/global.js +++ b/packages/react/src/global.js @@ -14,8 +14,8 @@ type GlobalProps = { +styles: Styles | (Object => Styles) } -const useInsertionEffect = (React: any).useInsertionEffect - ? (React: any).useInsertionEffect +const useInsertionEffect = React['useInsertion' + 'Effect'] + ? React['useInsertion' + 'Effect'] : React.useLayoutEffect let warnedAboutCssPropForGlobal = false diff --git a/packages/react/src/useInsertionEffectMaybe.js b/packages/react/src/useInsertionEffectMaybe.js index a1a9ed0e9..1438d1a7f 100644 --- a/packages/react/src/useInsertionEffectMaybe.js +++ b/packages/react/src/useInsertionEffectMaybe.js @@ -1,9 +1,9 @@ -import React from 'react' +import * as React from 'react' const isBrowser = typeof document !== 'undefined' -const useInsertionEffect = React.useInsertionEffect - ? React.useInsertionEffect +const useInsertionEffect = React['useInsertion' + 'Effect'] + ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) { create() } diff --git a/packages/styled/src/useInsertionEffectMaybe.js b/packages/styled/src/useInsertionEffectMaybe.js index a1a9ed0e9..1438d1a7f 100644 --- a/packages/styled/src/useInsertionEffectMaybe.js +++ b/packages/styled/src/useInsertionEffectMaybe.js @@ -1,9 +1,9 @@ -import React from 'react' +import * as React from 'react' const isBrowser = typeof document !== 'undefined' -const useInsertionEffect = React.useInsertionEffect - ? React.useInsertionEffect +const useInsertionEffect = React['useInsertion' + 'Effect'] + ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) { create() }