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() }