Documentation
Plugins
Next

Next.js

plaiceholder packages are ESM only (opens in a new tab).

An essential plugin for Next.js, ensuring that all Plaiceholder functions start in the main thread.

Installation

  1. Add the package alongside your existing plaiceholder installation:

    npm install @plaiceholder/next
  2. Wrap your Next.js config with withPlaiceholder:

    Your Next.js config must use the .mjs extension.
    (or .ts when supported)

    next.config.mjs
    // @ts-check
    import withPlaiceholder from "@plaiceholder/next";
     
    /**
     * @type {import('next').NextConfig}
     */
    const config = {
      // your Next.js config
    };
     
    export default withPlaiceholder(config);

Usage

…and that's it! Use Next.js and plaiceholder as you would expect.