fix(blob): declare @vercel/blob as optional peer dependency#904
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #859, supersedes #860 (credit to @onmax for the original investigation and the optional peer-dependency approach).
This PR declares
@vercel/blobas 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.