网页 综合 更新时间 2026-11-16 04:29:38

@nuxt/image · Nuxt Modules

自动蜘蛛 nuxt.com 正文约 2243 字
@nuxt/image · Nuxt Modules
Nuxt Image adds <NuxtImg> and <NuxtPicture> components to your app: drop-in replacements for the native img and picture elements that resize, transform and serve optimized images, with the built-in optimizer or the image CDN you already use.
To get started, add @nuxt/image to your project:
Add @nuxt/image dependency to your project:
Then, add it to the modules in your nuxt.config:
The default IPX provider uses sharp for image processing. At install time, your package manager downloads prebuilt sharp binaries only for your current OS and CPU architecture. This means if you build on macOS or Windows and deploy to a Linux server (or build on x64 and deploy to ARM64), the required sharp binaries might be missing, resulting in errors like:
To fix this, configure your package manager to install sharp binaries for all target platforms, e.g.:
After updating the configuration, reinstall dependencies to download the additional platform binaries.
For more details, see the sharp cross-platform documentation.
Add an image section in your nuxt.config:
After each commit is merged into the main branch of @nuxt/image and passing all tests, we trigger an automated npm release using GitHub Actions publishing a @nuxt/image-nightly package.
You can opt in to use this release channel and avoid waiting for the next release and helping the module by beta testing changes.
The build and publishing method and quality of nightly releases are the same as stable ones. The only difference is that you should often check the GitHub repository for updates. There is a slight chance of regressions not being caught during the review process and by the automated tests. Therefore, we internally use this channel to double-check everything before each release.
Update @nuxt/image dependency inside package.json:
Remove lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml) and reinstall dependencies.
Update @nuxt/image dependency inside package.json:
Remove lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml) and reinstall dependencies.
If an error occurs during installation:
Nuxt Image is configured with sensible defaults.
Stay updated on new releases and features, guides, and community updates.
Copyright © 2016-2026 Nuxt - MIT License
访问原文 返回搜索 https://nuxt.com/modules/image
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。