Skip to content

fix(blob): declare @vercel/blob as optional peer dependency#904

Merged
RihanArfan merged 4 commits into
mainfrom
fix/blob-vercel-optional-peer-dep
Jun 2, 2026
Merged

fix(blob): declare @vercel/blob as optional peer dependency#904
RihanArfan merged 4 commits into
mainfrom
fix/blob-vercel-optional-peer-dep

Conversation

@RihanArfan

@RihanArfan RihanArfan commented Jun 2, 2026

Copy link
Copy Markdown
Member

Closes #859, supersedes #860 (credit to @onmax for the original investigation and the optional peer-dependency approach).

This PR declares @vercel/blob as an optional peerDependency so the bundler externalizes the @vercel/blob/client specifier across every blob driver, which is what actually fixes the Rollup failed to resolve import "@vercel/blob/client" build failure (#859) when the package isn't installed; with that in place the useMultipartUpload composable can drop the @vite-ignore variable-indirection workaround and use a plain static await import('@vercel/blob/client').

Compared to @onmax's #860, it shares the same two core changes (the optional peer dependency and the static import — the part that does the work) but omits the vite.optimizeDeps.exclude / nitro.externals block and its test, which I verified are redundant: the peer-dependency declaration alone makes the build pass for fs, cloudflare-r2, and vercel-blob in both dev and build (and stripping it reproduces the original error), so the externalization gated on the vercel-blob driver never contributes to the fix.

The `useMultipartUpload` composable dynamically imports `@vercel/blob/client`
for the Vercel Blob provider. Because the specifier was not known to the
bundler, builds (notably the Cloudflare preset) failed with
`Rollup failed to resolve import "@vercel/blob/client"` whenever the package
was not installed, even for non-Vercel drivers (fs, cloudflare-r2).

Declare `@vercel/blob` as an optional peerDependency so the bundler
externalizes it across all drivers, and drop the `@vite-ignore` variable
indirection in favour of a plain static `import('@vercel/blob/client')`.

Closes #859

Co-authored-by: onmax <maximogarciamtnez@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nuxthub Ready Ready Preview Jun 2, 2026 1:07pm

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 2, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
playground cf38c6b Commit Preview URL

Branch Preview URL
Jun 02 2026, 01:06 PM

@RihanArfan RihanArfan merged commit 1abb10a into main Jun 2, 2026
7 checks passed
@RihanArfan RihanArfan deleted the fix/blob-vercel-optional-peer-dep branch June 2, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useMultipartUpload Failed to resolve import "@vercel/blob/client" error on startup

1 participant