Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 13, 2022 06:12 am GMT

Add storybook.js to a sveltekit project

First Create a sveltekit project and initialize storybook.js

1. npm init svelte@next sb-svelte2. cd sb-svelte3. npm install4. npx sb@next init5. npm run storybook

Running storybook at this moment should give you error. Here are the steps for the fix:

  1. change "type": "commonjs" in package.json

change type to commonjs - Step 1

  1. rename svelte.config.js to svelte.config.mjs

  2. replace your .storybook/main.js with following code:

module.exports = {    stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx|svelte)'],    addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-svelte-csf'],    framework: '@storybook/svelte',    svelteOptions: {        preprocess: import('../svelte.config.mjs').preprocess    }};

Original Link: https://dev.to/kiranojhanp/add-storybookjs-to-a-sveltekit-project-40n5

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To