-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
feat(build): only exports vanilla
in React Server Component
#2274
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 142ba5b:
|
9a517a6
to
87e2144
Compare
package.json
Outdated
"./react": { | ||
"import": { | ||
"types": "./esm/react.d.mts", | ||
"react-server": "./esm/error.mjs", | ||
"default": "./esm/react.mjs" | ||
}, | ||
"default": { | ||
"react-server": "./error.js", | ||
"types": "./react.d.ts", | ||
"default": "./react.js" | ||
} | ||
}, | ||
"./react/*": { | ||
"import": { | ||
"types": "./esm/*.d.mts", | ||
"react-server": "./esm/error.mjs", | ||
"default": "./esm/*.mjs" | ||
}, | ||
"default": { | ||
"types": "./*.d.ts", | ||
"react-server": "./error.js", | ||
"default": "./*.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.
I go through the code, and all react* files uses or useAtom
which is not accepted in react server environment
While this might improve the RSC developer experience, I don't think it solves #2241. At this point, I don't think adding If we don't have a solution with |
revert would be better |
There might be another approach. We have This might help if people did import |
I made some changes, reopening... |
vanilla
in React Server Component
Unfortunately, it doesn't change my previous comment. I feel it's worse because it hides the error.
That's recommended. So, it's a doc issue. |
Related Issues or Discussions
Revert: #2245
Fixes: #2269
Summary
Only exports
vanilla
files in react server condition when importingjotai
.This behavior will be similar to swr(https://github.com/vercel/swr/blob/main/core/src/index.react-server.ts). Like they only exports few function when react server
Check List
yarn run prettier
for formatting code and docs