-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Remix V1 to V2: Module '"@remix-run/node"' has no exported member 'fetch'.ts(2305)
#7567
Comments
I think we should include users won't need to go install |
Tried using
Based off the error message, it looks like its trying to find Browser
Node
When I import "exports": {
".": {
"types": "./dist/src/lib.node.d.ts",
"browser": {
"require": "./dist/lib.cjs",
"import": "./src/lib.js" // <------- 🟡 where its trying to grab fetch from
},
"require": "./dist/lib.node.cjs", // <------- 🟡 where its should be trrying to get it from
"import": "./src/lib.node.js"
},
"./package.json": "./package.json",
"./body": {
"types": "./dist/src/body.d.ts",
"import": "./src/body.js"
},
"./src/request.js": {
"types": "./dist/src/request.d.ts",
"import": "./src/request.js"
},
}, |
I think the temp solution is for me to install import fetch, {Request, Response} from "node-fetch" ahh extra dependency =/; I want to be using the QuestionAs far as I can tell, I think if someone wants proper typing of References
|
Importing from the global namespace is by design in v2 as we want to lean more into the platform/built-ins. If It looks we need to dig into the typings and see what our options are there for differences between node |
Maybe in the future, the |
That would be incorrect though if they don't call |
@brophdawg11 there are also inconsistencies around |
I'm going to close this out because we're adopting the native |
What version of Remix are you using?
2.0.1
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Was starting to upgrade to Remix V2, then I started seeing this error message in my app:
I know this is because
fetch
export was removed the@remix-run/node
package per this PR #7293Question
Is the only way to reliably get proper
fetch
typing forfetch
on the server/nodejs to import it?installGlobals
doesn't help because when I COMMAND + CLICK intofetch
implementation, I am taken to this type definition file located here:The browser implementation of
fetch
obviously doesnt have types for passing things likeagent
& other nodejs specif stuff tofetch
's request options object.For example, in my remix app, we need to pass a custom agent to our fetch
The text was updated successfully, but these errors were encountered: