Skip to content

Commit d15e783

Browse files
Add exports field to packages with multiple entrypoints (#508)
1 parent 33b9aaf commit d15e783

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-0
lines changed

.changeset/grumpy-carrots-arrive.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@vanilla-extract/css': patch
3+
'@vanilla-extract/dynamic': patch
4+
'@vanilla-extract/recipes': patch
5+
'@vanilla-extract/sprinkles': patch
6+
'@vanilla-extract/webpack-plugin': patch
7+
---
8+
9+
Add `exports` field to `package.json` so nested package paths can be imported in a Node.js ESM context

packages/css/package.json

+67
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,73 @@
99
"./dist/vanilla-extract-css.cjs.js": "./dist/vanilla-extract-css.browser.cjs.js",
1010
"./dist/vanilla-extract-css.esm.js": "./dist/vanilla-extract-css.browser.esm.js"
1111
},
12+
"exports": {
13+
"./package.json": "./package.json",
14+
".": {
15+
"browser": {
16+
"module": "./dist/vanilla-extract-css.browser.esm.js",
17+
"default": "./dist/vanilla-extract-css.browser.cjs.js"
18+
},
19+
"module": "./dist/vanilla-extract-css.esm.js",
20+
"default": "./dist/vanilla-extract-css.cjs.js"
21+
},
22+
"./recipe": {
23+
"browser": {
24+
"module": "./recipe/dist/vanilla-extract-css-recipe.browser.esm.js",
25+
"default": "./recipe/dist/vanilla-extract-css-recipe.browser.cjs.js"
26+
},
27+
"module": "./recipe/dist/vanilla-extract-css-recipe.esm.js",
28+
"default": "./recipe/dist/vanilla-extract-css-recipe.cjs.js"
29+
},
30+
"./functionSerializer": {
31+
"browser": {
32+
"module": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.browser.esm.js",
33+
"default": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.browser.cjs.js"
34+
},
35+
"module": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.esm.js",
36+
"default": "./functionSerializer/dist/vanilla-extract-css-functionSerializer.cjs.js"
37+
},
38+
"./adapter": {
39+
"browser": {
40+
"module": "./adapter/dist/vanilla-extract-css-adapter.browser.esm.js",
41+
"default": "./adapter/dist/vanilla-extract-css-adapter.browser.cjs.js"
42+
},
43+
"module": "./adapter/dist/vanilla-extract-css-adapter.esm.js",
44+
"default": "./adapter/dist/vanilla-extract-css-adapter.cjs.js"
45+
},
46+
"./transformCss": {
47+
"browser": {
48+
"module": "./transformCss/dist/vanilla-extract-css-transformCss.browser.esm.js",
49+
"default": "./transformCss/dist/vanilla-extract-css-transformCss.browser.cjs.js"
50+
},
51+
"module": "./transformCss/dist/vanilla-extract-css-transformCss.esm.js",
52+
"default": "./transformCss/dist/vanilla-extract-css-transformCss.cjs.js"
53+
},
54+
"./fileScope": {
55+
"browser": {
56+
"module": "./fileScope/dist/vanilla-extract-css-fileScope.browser.esm.js",
57+
"default": "./fileScope/dist/vanilla-extract-css-fileScope.browser.cjs.js"
58+
},
59+
"module": "./fileScope/dist/vanilla-extract-css-fileScope.esm.js",
60+
"default": "./fileScope/dist/vanilla-extract-css-fileScope.cjs.js"
61+
},
62+
"./injectStyles": {
63+
"browser": {
64+
"module": "./injectStyles/dist/vanilla-extract-css-injectStyles.browser.esm.js",
65+
"default": "./injectStyles/dist/vanilla-extract-css-injectStyles.browser.cjs.js"
66+
},
67+
"module": "./injectStyles/dist/vanilla-extract-css-injectStyles.esm.js",
68+
"default": "./injectStyles/dist/vanilla-extract-css-injectStyles.cjs.js"
69+
},
70+
"./disableRuntimeStyles": {
71+
"browser": {
72+
"module": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.browser.esm.js",
73+
"default": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.browser.cjs.js"
74+
},
75+
"module": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.esm.js",
76+
"default": "./disableRuntimeStyles/dist/vanilla-extract-css-disableRuntimeStyles.cjs.js"
77+
}
78+
},
1279
"preconstruct": {
1380
"entrypoints": [
1481
"index.ts",

packages/dynamic/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
"sideEffects": false,
66
"main": "dist/vanilla-extract-dynamic.cjs.js",
77
"module": "dist/vanilla-extract-dynamic.esm.js",
8+
"exports": {
9+
"./package.json": "./package.json",
10+
".": {
11+
"module": "./dist/vanilla-extract-dynamic.esm.js",
12+
"default": "./dist/vanilla-extract-dynamic.cjs.js"
13+
}
14+
},
815
"files": [
916
"/dist"
1017
],

packages/recipes/package.json

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
"sideEffects": false,
66
"main": "dist/vanilla-extract-recipes.cjs.js",
77
"module": "dist/vanilla-extract-recipes.esm.js",
8+
"exports": {
9+
"./package.json": "./package.json",
10+
".": {
11+
"module": "./dist/vanilla-extract-recipes.esm.js",
12+
"default": "./dist/vanilla-extract-recipes.cjs.js"
13+
},
14+
"./createRuntimeFn": {
15+
"module": "./createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js",
16+
"default": "./createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"
17+
}
18+
},
819
"files": [
920
"/dist",
1021
"/createRuntimeFn"

packages/sprinkles/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
"sideEffects": false,
66
"main": "dist/vanilla-extract-sprinkles.cjs.js",
77
"module": "dist/vanilla-extract-sprinkles.esm.js",
8+
"exports": {
9+
"./package.json": "./package.json",
10+
".": {
11+
"module": "./dist/vanilla-extract-sprinkles.esm.js",
12+
"default": "./dist/vanilla-extract-sprinkles.cjs.js"
13+
},
14+
"./createRuntimeSprinkles": {
15+
"module": "./createRuntimeSprinkles/dist/vanilla-extract-sprinkles-createRuntimeSprinkles.esm.js",
16+
"default": "./createRuntimeSprinkles/dist/vanilla-extract-sprinkles-createRuntimeSprinkles.cjs.js"
17+
},
18+
"./createUtils": {
19+
"module": "./createUtils/dist/vanilla-extract-sprinkles-createUtils.esm.js",
20+
"default": "./createUtils/dist/vanilla-extract-sprinkles-createUtils.cjs.js"
21+
}
22+
},
823
"files": [
924
"/dist",
1025
"/createRuntimeSprinkles",

packages/webpack-plugin/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
"description": "Zero-runtime Stylesheets-in-TypeScript",
55
"main": "dist/vanilla-extract-webpack-plugin.cjs.js",
66
"module": "dist/vanilla-extract-webpack-plugin.esm.js",
7+
"exports": {
8+
"./package.json": "./package.json",
9+
".": {
10+
"module": "./dist/vanilla-extract-webpack-plugin.esm.js",
11+
"default": "./dist/vanilla-extract-webpack-plugin.cjs.js"
12+
},
13+
"./loader": {
14+
"module": "./loader/dist/vanilla-extract-webpack-plugin-loader.esm.js",
15+
"default": "./loader/dist/vanilla-extract-webpack-plugin-loader.cjs.js"
16+
},
17+
"./extracted": {
18+
"module": "./extracted/dist/vanilla-extract-webpack-plugin-extracted.esm.js",
19+
"default": "./extracted/dist/vanilla-extract-webpack-plugin-extracted.cjs.js"
20+
}
21+
},
722
"preconstruct": {
823
"entrypoints": [
924
"index.ts",

0 commit comments

Comments
 (0)