Remove Storybook from Next.js & Slice Machine

Learn how to remove Storybook and prepare your app for Slice Simulations.


1. Delete the .storybook file

 .slicemachine
-.storybook
 components
 customtypes

2. Uninstall the dependencies

Use either the npm or yarn commands below:

npm

npm uninstall @storybook/react

yarn

yarn remove @storybook/react

Other dependencies

You can also remove any other Storybook-related dependencies such as babel-loader, babel-plugin-react-require, and any others you are using.

3. Remove the Storybook scripts from your package.json

Remove the storybook and build-storybook scripts:

"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "export": "next export",
  "slicemachine": "start-slicemachine --port 9999",
- "storybook": "start-storybook -p 8888",
- "build-storybook": "build-storybook"
},

4. Update the sm.json

Remove the "storybook" configuration.

{
  "apiEndpoint": "https://your-repo-name.cdn.prismic.io/api/v2",
  "libraries": [
    "@/slices"
  ],
  "_latest": "0.2.0",
- "storybook": "http://localhost:8888"
}