Setting up a Next.js app with Sitecore JSS CLI in disconnected mode involves several steps. Here’s a comprehensive guide to get you started:
Step 1: Install the required packages
To start, we need to install the required packages. Run the following command in your terminal:
npm install @sitecore-jss/sitecore-jss @sitecore-jss/sitecore-jss-nextjs
Step 2: Create a new Next.js app with Sitecore JSS CLI
Next, we will create a new Next.js app using the Sitecore JSS CLI. Run the following command:
npm init sitecore-jss my-first-jss-app nextjs
Once the below screen has appeared, don’t forget to select add-on initializers by pressing space; only manifest files will then be generated, otherwise some errors could arise.
Now navigate to your application directory and type in “jss start” command for running application in disconnected mode.
Access the application remotely at http://localhost:3000 in disconnected mode.
In this part, we learned how to setup Next.js app using Sitecore JSS CLI for disconnected mode development speed and testing purposes. When you’re ready to integrate with a Sitecore server, refer to our guide on Setup Next.js App with Sitecore JSS CLI in connected mode for a seamless transition.
Additional Links
How to setup Next.js App with Sitecore JSS CLI in Connected Mode