storage: Unable to resolve "@vercel/blob/client"

Using React Native with Expo and ran yarn add @vercel/blob. When I try to do:

import { upload } from "@vercel/blob/client";
 const newBlob = await upload(name, buffer....

I get:

Unable to resolve "@vercel/blob/client" from "screens/HomeScreen.tsx"

Version:

"@vercel/blob": "^0.15.1",

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (7 by maintainers)

Most upvoted comments

@sajeeIfonix Can you bring this issue over to the expo repository? Our package.json is correct as per https://arethetypeswrong.github.io/?p=%40vercel%2Fblob%400.22.3 so I suspect something is wrong with expo/expo setup here. It would be awesome to find out what 🙏

@sajeeIfonix Can you bring this issue over to the expo repository? Our package.json is correct as per https://arethetypeswrong.github.io/?p=%40vercel%2Fblob%400.22.3 so I suspect something is wrong with expo/expo setup here. It would be awesome to find out what 🙏

Thanks for looking into this. I guess we’ll use AWS S3 until this issue is resolved.

I found if you add:

"resolver": {
    "unstable_enablePackageExports": true
}

to your metro config, the bundler can correctly resolve the @vercel/blob/client import. This is needed because @vercel/blob relies on the exports field in the pjson.

This leads to a different error for me though where import * as crypto from "crypto" can’t be resolved. Here it seems like the module resolution is wrong again. It’s trying to import from node_modules/@vercel/dist/crypto-browser.js where the real path would be node_modules/@vercel/blob/dist/crypto-browser.js.

If you also run into this issue it might be worth opening an issue in expo or metro