Sitecore Next Js application in disconnected mode

Introduction

In this blog we are going to setup a basic NextJs JSS application in disconnected mode using latest version of Node.js available.


Setup

Install the latest version of Node




Install Sitecore JSS CLI

npm install -g @sitecore-jss/sitecore-jss-cli

Create a base next js application using JSS CLI

If you use the below command to create application, the application will not be created because jss create is not supported from JSS CLI 20.0.0. 

jss create demo nextjs



To fix this, either we have to downgrade the JSS CLI to 19.0.0 version or use the below to create the application.

npm init sitecore-jss 

There will be lot of options shown below to create the application, and to create the application in disconnected mode, choose REST instead of GraphQL and choose nextjs-styleguide - Includes example components and setup for working disconnected for add-on initializer.


Once the application is created it will look like this - 



Go to the application folder and run the application in the disconnected mode - 

jss start




Browse - http://localhost:3000

Happy Sitecoring!!!



Comments