Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using react typescript project with storybook - failing run storybook #168

Open
manik-ushur opened this issue Nov 8, 2022 · 1 comment

Comments

@manik-ushur
Copy link

manik-ushur commented Nov 8, 2022

Describe the bug
Failing to run storybook

To Reproduce

  1. Already existing react typescript project with build craco, babel
  2. This is the setting in craco.config
webpackConfig.module.rules.push({
        test: /\.(ts|tsx)$/,
        //exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-typescript"],
            plugins: ["istanbul"]
          }
        }
      });
      webpackConfig.module.rules.push({
        test: /\.(js|jsx)$/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env', '@babel/preset-react']
          }
        }
      });
      return webpackConfig;
  1. Following updates:
npm i botui@next @botui/react
npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
import { createBot } from 'botui'
import { BotUI, BotUIMessageList, BotUIAction, useBotUI } from '@botui/react'

const myBot = createBot()
useEffect(() => {
    myBot
      .wait({ waitTime: 1000 })
      .then(() => myBot.message.add({ text: 'hello, what is your name?' }))
      .then(() => myBot.action.set(
          {
            options: [
              { label: 'John', value: 'john' },
              { label: 'Jane', value: 'jane' },
            ],
          },
          { actionType: 'select' }
      ))
      .then((data) => myBot.message.add({ text: `nice to meet you ${data.selected.label}` }))
  }, [])

package.json

"storybook": "cross-env REACT_APP_MOCK_SERVER=MSW start-storybook -p 6006 -s public",
  1. Run npm run storybook

Expected behavior
The build should complete successfully and storybook should start

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: chrome
  • Version: latest version
  • Bash: git bash
@moinism
Copy link
Member

moinism commented Jan 2, 2023

Hey @manik-ushur were you able to find a solution for this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants