-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 importing in Node ESM #3029
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
'@emotion/babel-plugin': patch | ||
'@emotion/babel-plugin-jsx-pragmatic': patch | ||
'@emotion/babel-preset-css-prop': patch | ||
'@emotion/cache': patch | ||
'@emotion/css': patch | ||
'@emotion/css-prettifier': patch | ||
'@emotion/eslint-plugin': patch | ||
'@emotion/hash': patch | ||
'@emotion/is-prop-valid': patch | ||
'@emotion/jest': patch | ||
'@emotion/memoize': patch | ||
'@emotion/native': patch | ||
'@emotion/primitives': patch | ||
'@emotion/primitives-core': patch | ||
'@emotion/react': patch | ||
'@emotion/serialize': patch | ||
'@emotion/server': patch | ||
'@emotion/sheet': patch | ||
'@emotion/styled': patch | ||
'@emotion/unitless': patch | ||
'@emotion/use-insertion-effect-with-fallbacks': patch | ||
'@emotion/utils': patch | ||
'@emotion/weak-memoize': patch | ||
--- | ||
|
||
Fixed importing in Node ESM |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './macro.js' |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,9 +9,7 @@ | |||||||||||||||||||||||||||||||
"src", | ||||||||||||||||||||||||||||||||
"dist", | ||||||||||||||||||||||||||||||||
"types", | ||||||||||||||||||||||||||||||||
"macro.js", | ||||||||||||||||||||||||||||||||
"macro.d.ts", | ||||||||||||||||||||||||||||||||
"macro.js.flow", | ||||||||||||||||||||||||||||||||
"macro.*", | ||||||||||||||||||||||||||||||||
"create-instance" | ||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||
"scripts": { | ||||||||||||||||||||||||||||||||
|
@@ -46,10 +44,12 @@ | |||||||||||||||||||||||||||||||
"exports": { | ||||||||||||||||||||||||||||||||
".": { | ||||||||||||||||||||||||||||||||
"module": "./dist/emotion-css.esm.js", | ||||||||||||||||||||||||||||||||
"import": "./dist/emotion-css.cjs.mjs", | ||||||||||||||||||||||||||||||||
"default": "./dist/emotion-css.cjs.js" | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
"./create-instance": { | ||||||||||||||||||||||||||||||||
"module": "./create-instance/dist/emotion-css-create-instance.esm.js", | ||||||||||||||||||||||||||||||||
"import": "./create-instance/dist/emotion-css-create-instance.cjs.mjs", | ||||||||||||||||||||||||||||||||
"default": "./create-instance/dist/emotion-css-create-instance.cjs.js" | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
"./package.json": "./package.json", | ||||||||||||||||||||||||||||||||
|
@@ -63,7 +63,13 @@ | |||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||
"exports": { | ||||||||||||||||||||||||||||||||
"extra": { | ||||||||||||||||||||||||||||||||
"./macro": "./macro.js" | ||||||||||||||||||||||||||||||||
"./macro": { | ||||||||||||||||||||||||||||||||
"types": { | ||||||||||||||||||||||||||||||||
"import": "./macro.d.mts", | ||||||||||||||||||||||||||||||||
"default": "./macro.d.ts" | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
"default": "./macro.js" | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
Comment on lines
+72
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I'm not a fan of array flavor... maybe, in here, this would actually be a little bit more obvious that the "fallthrough" is intended?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind, just leave it how it is. (it looks like arethetypeswrong incorrectly flags this as a problem, will open an issue about that in a moment) |
||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './macro.js' | ||
export { _default as default } from './macro.default.js' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import styled from '@emotion/native' | ||
export * from '@emotion/native' | ||
export default styled |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as _default } from './macro.js' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './macro.js' |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,2 @@ | ||||||||||
export * from './macro.js' | ||||||||||
export { _default as default } from './macro.default.js' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
+ delete the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm, why is that? 🤔 it seems to me that TS would trip over this without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're in a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, that makes sense 👍 i wouldn't use a self reference here myself (it makes sense to use it - i just wouldnt think of it myself) but it was already here and it makes sense that with it we can simplify this a little bit. (EDIT:// ah, the self reference in this particular file is part of your proposed change, nice) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
declare module '@emotion/styled/macro' { | ||
import styled from '@emotion/styled' | ||
export * from '@emotion/styled' | ||
export default styled | ||
} | ||
import styled from '@emotion/styled' | ||
export * from '@emotion/styled' | ||
export default styled |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as _default } from './macro.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, i wasn't sure if this would "fall through" to the other default... does it? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does (but that's correct behaviour, not like TS's bug)