@elliott-w/next-export-optimize-images
v4.8.1
Published
Optimize images at build time with Next.js.
Maintainers
Readme
Next Export Optimize Images
Using this repository, you can get the full benefits of next/image even when using next export by doing image optimization at build time.
This makes it possible to build a high performance website with this solution, whether you want to build a simple website or a completely static output.
Feature
- Optimize images at build time.
- All options for
next/imageavailable - Convert formats (png → webp, etc.)
- Download external images locally.
- Using
sharp, so it's fast. - Cache prevents repeating the same optimization
- Support TypeScript
- Support AppRouter
srcSetstops at the source's intrinsic width — no upscaled variants are generated or requested
Installation
This fork ships through two channels. Pick whichever fits your workflow — they're functionally identical, the only difference is the import specifier.
Option 1: npm (scoped package)
Published to npm as @elliott-w/next-export-optimize-images:
npm install @elliott-w/next-export-optimize-imagesImports use the scoped name:
import withExportImages from '@elliott-w/next-export-optimize-images'
import Image from '@elliott-w/next-export-optimize-images/image'
import RemoteImage from '@elliott-w/next-export-optimize-images/remote-image'Option 2: Direct from GitHub
Useful for pinning to a specific commit, or running off main without waiting for a release:
# latest main
npm install github:elliott-w/next-export-optimize-images
# pinned to a specific commit (recommended)
npm install github:elliott-w/next-export-optimize-images#<commit-sha>With this method the dependency name stays as the unscoped next-export-optimize-images, so imports use the unscoped name:
import withExportImages from 'next-export-optimize-images'
import Image from 'next-export-optimize-images/image'
import RemoteImage from 'next-export-optimize-images/remote-image'The prepare script builds dist/ on install, so no extra setup is needed in the consuming app.
Document Site
https://next-export-optimize-images.vercel.app
DeepWiki
https://deepwiki.com/dc7290/next-export-optimize-images
License
Next Export Optimize Images is available under the MIT License.
