Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a transpilation issue that caused useInsertionEffect to be referenced directly in the specifiers list of the import statement #2651

Merged
merged 1 commit into from Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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