Stackbit Development Server

The Stackbit development server is run using the stackbit dev command.

experimental-next-stackbit can be used in conjunction with next-contentlayer to hook the contentlayer dev and stackbit dev commands into the Next.js development server (next dev). See below for usage.

withStackbit

Next.js configuration, along with the withContentlayer hook should be wrapped in the withStackbit method.

// next.config.js

const { withContentlayer } = require('next-contentlayer')
const { withStackbit } = require('experimental-next-stackbit')

module.exports = withStackbit(
  withContentlayer({
    reactStrictMode: true,
  }),
)

This function will automatically detect if you are in production (when process.env.NODE_ENV is production) and skip running the Stackbit development server.


Was this article helpful to you?
Provide feedback

Last edited on April 01, 2024.
Edit this page