Skip to content

Commit eed5e6c

Browse files
authored
Fixed importing in Node ESM (#3029)
* Fixed importing in Node ESM * Fixed macro types * rerun preconstruct fix * remove redundant .default files
1 parent e6e5b3d commit eed5e6c

File tree

32 files changed

+203
-56
lines changed

32 files changed

+203
-56
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@emotion/babel-plugin': patch
3+
'@emotion/babel-plugin-jsx-pragmatic': patch
4+
'@emotion/babel-preset-css-prop': patch
5+
'@emotion/cache': patch
6+
'@emotion/css': patch
7+
'@emotion/css-prettifier': patch
8+
'@emotion/eslint-plugin': patch
9+
'@emotion/hash': patch
10+
'@emotion/is-prop-valid': patch
11+
'@emotion/jest': patch
12+
'@emotion/memoize': patch
13+
'@emotion/native': patch
14+
'@emotion/primitives': patch
15+
'@emotion/primitives-core': patch
16+
'@emotion/react': patch
17+
'@emotion/serialize': patch
18+
'@emotion/server': patch
19+
'@emotion/sheet': patch
20+
'@emotion/styled': patch
21+
'@emotion/unitless': patch
22+
'@emotion/use-insertion-effect-with-fallbacks': patch
23+
'@emotion/utils': patch
24+
'@emotion/weak-memoize': patch
25+
---
26+
27+
Fixed importing in Node ESM

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@
128128
"react/jsx-runtime": "ReactJSX",
129129
"react/jsx-dev-runtime": "ReactJSXDev"
130130
},
131-
"exports": true,
132-
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
133-
"exports": true
131+
"exports": {
132+
"importConditionDefaultExport": "default"
134133
}
135134
},
136135
"bugs": {
@@ -181,7 +180,7 @@
181180
"@changesets/changelog-github": "^0.4.0",
182181
"@changesets/cli": "^2.16.0",
183182
"@manypkg/cli": "^0.19.1",
184-
"@preconstruct/cli": "^2.2.1",
183+
"@preconstruct/cli": "^2.6.2",
185184
"@testing-library/react": "13.0.0-alpha.5",
186185
"@types/jest": "^27.0.3",
187186
"@types/node": "^12.20.37",

packages/babel-plugin-jsx-pragmatic/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"exports": {
88
".": {
99
"module": "./dist/emotion-babel-plugin-jsx-pragmatic.esm.js",
10+
"import": "./dist/emotion-babel-plugin-jsx-pragmatic.cjs.mjs",
1011
"default": "./dist/emotion-babel-plugin-jsx-pragmatic.cjs.js"
1112
},
1213
"./package.json": "./package.json"

packages/babel-plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"exports": {
88
".": {
99
"module": "./dist/emotion-babel-plugin.esm.js",
10+
"import": "./dist/emotion-babel-plugin.cjs.mjs",
1011
"default": "./dist/emotion-babel-plugin.cjs.js"
1112
},
1213
"./package.json": "./package.json"

packages/babel-preset-css-prop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"exports": {
88
".": {
99
"module": "./dist/emotion-babel-preset-css-prop.esm.js",
10+
"import": "./dist/emotion-babel-preset-css-prop.cjs.mjs",
1011
"default": "./dist/emotion-babel-preset-css-prop.cjs.js"
1112
},
1213
"./package.json": "./package.json"

packages/cache/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"browser": "./dist/emotion-cache.browser.esm.js",
1515
"default": "./dist/emotion-cache.esm.js"
1616
},
17+
"import": "./dist/emotion-cache.cjs.mjs",
1718
"default": "./dist/emotion-cache.cjs.js"
1819
},
1920
"./package.json": "./package.json"

packages/css-prettifier/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"exports": {
1212
".": {
1313
"module": "./dist/emotion-css-prettifier.esm.js",
14+
"import": "./dist/emotion-css-prettifier.cjs.mjs",
1415
"default": "./dist/emotion-css-prettifier.cjs.js"
1516
},
1617
"./package.json": "./package.json"

packages/css/macro.d.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './macro.js'

packages/css/package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"src",
1010
"dist",
1111
"types",
12-
"macro.js",
13-
"macro.d.ts",
14-
"macro.js.flow",
12+
"macro.*",
1513
"create-instance"
1614
],
1715
"scripts": {
@@ -46,14 +44,22 @@
4644
"exports": {
4745
".": {
4846
"module": "./dist/emotion-css.esm.js",
47+
"import": "./dist/emotion-css.cjs.mjs",
4948
"default": "./dist/emotion-css.cjs.js"
5049
},
5150
"./create-instance": {
5251
"module": "./create-instance/dist/emotion-css-create-instance.esm.js",
52+
"import": "./create-instance/dist/emotion-css-create-instance.cjs.mjs",
5353
"default": "./create-instance/dist/emotion-css-create-instance.cjs.js"
5454
},
5555
"./package.json": "./package.json",
56-
"./macro": "./macro.js"
56+
"./macro": {
57+
"types": {
58+
"import": "./macro.d.mts",
59+
"default": "./macro.d.ts"
60+
},
61+
"default": "./macro.js"
62+
}
5763
},
5864
"preconstruct": {
5965
"umdName": "emotion",
@@ -63,7 +69,13 @@
6369
],
6470
"exports": {
6571
"extra": {
66-
"./macro": "./macro.js"
72+
"./macro": {
73+
"types": {
74+
"import": "./macro.d.mts",
75+
"default": "./macro.d.ts"
76+
},
77+
"default": "./macro.js"
78+
}
6779
}
6880
}
6981
}

packages/eslint-plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"exports": {
1515
".": {
1616
"module": "./dist/emotion-eslint-plugin.esm.js",
17+
"import": "./dist/emotion-eslint-plugin.cjs.mjs",
1718
"default": "./dist/emotion-eslint-plugin.cjs.js"
1819
},
1920
"./package.json": "./package.json"

0 commit comments

Comments
 (0)