storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.24k stars 9.26k forks source link

'npm run storybook' failed with problem of 'import type' #24016

Open hugoschellinger opened 1 year ago

hugoschellinger commented 1 year ago

Describe the bug

Hello ! 😄

I tried to create a story in another folder than the one created by storybook during the init, but I have an error when I want to launch the server:

image

main.ts :

const config: StorybookConfig = {
    stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)", "../assets/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
    addons: [
        "@storybook/addon-links",
        "@storybook/addon-essentials",
        "@storybook/addon-onboarding",
        "@storybook/addon-interactions",
        "@storybook/preset-create-react-app",
        "@storybook/theming",
        "@storybook/manager-api",
        "@storybook/addon-console",
        "@storybook/addon-a11y",
        "storybook-addon-mantine",
    ],
    framework: {
        name: "@storybook/react-webpack5",
        options: {},
    },
    docs: {
        autodocs: "tag",
        defaultName: "Doc",
    },
    core: {
        disableWhatsNewNotifications: true,
    },
    features: {
        storyStoreV7: true,
    },
};

.babelrc config :

{
  "sourceType": "unambiguous",
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "chrome": 100,
          "safari": 15,
          "firefox": 91
        }
      }
    ],
    "@babel/preset-typescript",
    "@babel/preset-react"
  ],
  "plugins": []
}

Tree of my environment :

/
├── .storybook/
├── .assets/
│   ├── test.stories.tsx ( problem file )
├── src/
│   ├── stories/
│   │   ├── one.stories.tsx
│   │   ├── two.stories.tsx
│   │   ├── three.stories.tsx
├── .babelrc

I want to specify that it is an Symfony environment !

Does anyone have an idea?

Available if you have any questions !

To Reproduce

No response

System

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Binaries:
    Node: 17.9.1 - ~\Documents\GIT\ACEoyA\node_modules\.bin\node.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (116.0.1938.62)
  npmPackages:
    @storybook/addon-a11y: ^7.2.1 => 7.4.0
    @storybook/addon-console: ^2.0.0 => 2.0.0
    @storybook/addon-essentials: ^7.2.1 => 7.4.0
    @storybook/addon-interactions: ^7.2.1 => 7.4.0
    @storybook/addon-links: ^7.2.1 => 7.4.0
    @storybook/addon-onboarding: ^1.0.8 => 1.0.8
    @storybook/blocks: ^7.2.1 => 7.4.0
    @storybook/manager-api: ^7.2.1 => 7.4.0
    @storybook/preset-create-react-app: ^7.2.1 => 7.4.0
    @storybook/react: ^7.2.1 => 7.4.0
    @storybook/react-webpack5: ^7.2.1 => 7.4.0
    @storybook/testing-library: ^0.2.0 => 0.2.0
    @storybook/theming: ^7.2.1 => 7.4.0

Additional context

No response

viktordanko commented 1 year ago

+1 Have very similar problem