feat(blob): add @nuxt/image integration via image.path config #698
+340
−6
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.
Fixes #521
What
Adds automatic
@nuxt/imageprovider for NuxtHub blob storage. When@nuxt/imageis installed andhub.blob.image.pathis configured:nuxthubprovider based on blob driver/cdn-cgi/image/w=X,q=Y/path)/_vercel/image?url=...&w=X&q=Y)Reproduction
Usage
Platform-Specific Notes
Cloudflare
BLOBin wrangler.jsoncVercel
@vercel/blobinstalled +BLOB_READ_WRITE_TOKENenv varnitro.preset: vercelin nuxt.config.tsvercel.json:{ "images": { "sizes": [300, 640, 750, 828, 1080, 1200, 1920, 2048, 3840] } }Technical Notes
@nuxt/image@^2.0.0(exports runtime providers)defineProvider()wrapper for proper @nuxt/image integrationUnresolved issues
Docs
Not sure if it is better to create a new Guide or leave the docs in the
/features/blobDev mode
During testing, I noticed that dev mode doesn't work straight away:
--remoteflag is used).Possible solutions
A. Require '--remote' for blob images. Document that blob images require 'nuxt dev --remote'.
B. Return a placeholder image in dev when the blob storage is empty.
C. Fallback to public folder: In dev, if the blob is empty, check the public folder as a fallback.
What is the preferred approach?