Skip to content

Commit 39ac5b9

Browse files
authored
Fixed a transpilation issue that caused useInsertionEffect to be referenced directly in the specifiers list of the import statement (#2651)
1 parent f6f5552 commit 39ac5b9

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

.changeset/dull-trees-crash.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@emotion/react': patch
3+
'@emotion/styled': patch
4+
---
5+
6+
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.

packages/react/src/global.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ type GlobalProps = {
1414
+styles: Styles | (Object => Styles)
1515
}
1616

17-
const useInsertionEffect = (React: any).useInsertionEffect
18-
? (React: any).useInsertionEffect
17+
const useInsertionEffect = React['useInsertion' + 'Effect']
18+
? React['useInsertion' + 'Effect']
1919
: React.useLayoutEffect
2020

2121
let warnedAboutCssPropForGlobal = false

packages/react/src/useInsertionEffectMaybe.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react'
1+
import * as React from 'react'
22

33
const isBrowser = typeof document !== 'undefined'
44

5-
const useInsertionEffect = React.useInsertionEffect
6-
? React.useInsertionEffect
5+
const useInsertionEffect = React['useInsertion' + 'Effect']
6+
? React['useInsertion' + 'Effect']
77
: function useInsertionEffect(create) {
88
create()
99
}

packages/styled/src/useInsertionEffectMaybe.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react'
1+
import * as React from 'react'
22

33
const isBrowser = typeof document !== 'undefined'
44

5-
const useInsertionEffect = React.useInsertionEffect
6-
? React.useInsertionEffect
5+
const useInsertionEffect = React['useInsertion' + 'Effect']
6+
? React['useInsertion' + 'Effect']
77
: function useInsertionEffect(create) {
88
create()
99
}

0 commit comments

Comments
 (0)