Skip to content

Commit 17295b3

Browse files
authored
Add worker-related conditions (#479)
This should improve support for Cloudflare Workers and Vercel Functions. Bundlers for workers often, annoyingly, prefer `browser` conditions over node/default - so when we include a browser condition, we, almost always, have to specify the worker conditions first in the context of React.
1 parent edd0bb2 commit 17295b3

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

packages/react-resizable-panels/package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
".": {
2121
"types": "./dist/react-resizable-panels.js",
2222
"development": {
23+
"edge-light": "./dist/react-resizable-panels.development.edge-light.js",
24+
"worker": "./dist/react-resizable-panels.development.edge-light.js",
25+
"workerd": "./dist/react-resizable-panels.development.edge-light.js",
2326
"browser": "./dist/react-resizable-panels.browser.development.js",
24-
"node": "./dist/react-resizable-panels.development.node.js",
27+
"node": "./dist/react-resizable-panels.development.edge-light.js",
2528
"default": "./dist/react-resizable-panels.development.js"
2629
},
30+
"edge-light": "./dist/react-resizable-panels.edge-light.js",
31+
"worker": "./dist/react-resizable-panels.edge-light.js",
32+
"workerd": "./dist/react-resizable-panels.edge-light.js",
2733
"browser": "./dist/react-resizable-panels.browser.js",
28-
"node": "./dist/react-resizable-panels.node.js",
34+
"node": "./dist/react-resizable-panels.edge-light.js",
2935
"default": "./dist/react-resizable-panels.js"
3036
},
3137
"./package.json": "./package.json"
@@ -36,9 +42,12 @@
3642
"default": "./src/env-conditions/production.ts"
3743
},
3844
"#is-browser": {
45+
"edge-light": "./src/env-conditions/server.ts",
46+
"workerd": "./src/env-conditions/server.ts",
47+
"worker": "./src/env-conditions/server.ts",
3948
"browser": "./src/env-conditions/browser.ts",
40-
"node": "./src/env-conditions/node.ts",
41-
"default": "./src/env-conditions/unknown.ts"
49+
"node": "./src/env-conditions/server.ts",
50+
"default": "./src/env-conditions/check-is-browser.ts"
4251
}
4352
},
4453
"types": "dist/react-resizable-panels.d.ts",

packages/react-resizable-panels/src/env-conditions/unknown.ts renamed to packages/react-resizable-panels/src/env-conditions/check-is-browser.ts

File renamed without changes.

packages/react-resizable-panels/src/env-conditions/node.ts renamed to packages/react-resizable-panels/src/env-conditions/server.ts

File renamed without changes.

0 commit comments

Comments
 (0)