next-strapi-image-loader
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

next-strapi-image-loader

This custom image loader seamlessly integrates Strapi apps with Next.js, handling image optimization through Strapi.

Benefits

Leaves image optimization to Strapi
No more wrapping every image source with <Image src={getStrapiUrl(...)} />, It does it for you.
Works with any file provider for Strapi

Getting Started

Install next-strapi-image-loader

yarn add next-strapi-image-loader
# or
npm install next-strapi-image-loader

Modify your next.config.js

// next.config.js

const { NextStrapiImageLoader } = require("next-strapi-image-loader");

/** @type {import('next').NextConfig} */
const nextConfig = NextStrapiImageLoader.with({
  reactStrictMode: true,
  // Following options are default options
  strapi: {
    // Breakpoints from your Strapi app see https://docs.strapi.io/dev-docs/plugins/upload#responsive-images
    breakpoints: {
      large: 1000,
      medium: 750,
      small: 500,
    },
    // Public URL of your Strapi App
    publicUrl: "http://localhost:1337",
    // If you are hosting images locally or remotely, this option is used to tell
    // next-strapi-image-loader to ignore those files
    excludeOrigins: [],
    excludeFiles: [],
  },
});

module.exports = nextConfig;

Package Sidebar

Install

npm i next-strapi-image-loader

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

19.4 kB

Total Files

7

Last publish

Collaborators

  • quiloos39