Skip to content

Commit

Permalink
Fixed a transpilation issue that caused useInsertionEffect to be re…
Browse files Browse the repository at this point in the history
…ferenced directly in the specifiers list of the import statement (#2651)
  • Loading branch information
Andarist committed Feb 19, 2022
1 parent f6f5552 commit 39ac5b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .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.
4 changes: 2 additions & 2 deletions packages/react/src/global.js
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions 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()
}
Expand Down
6 changes: 3 additions & 3 deletions 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()
}
Expand Down

0 comments on commit 39ac5b9

Please sign in to comment.