Failed to fetch dynamically imported module: http://localhost:6006/storybook/preview.jsx

See original GitHub issue

Describe the bug Getting Failed to fetch dynamically imported module: http://localhost:6006/storybook/preview.jsx when running storybook-start

To Reproduce

  1. run git clone https://github.com/jeremytenjo/starter-website && cd starter-website && npm i && npm run storybook:dev
  2. open http://localhost:6006/?path=/story/lib-components-basic-misc-codeblock--default

Result image

System

Environment Info:

  System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 95.0.2
    Safari: 15.5
  npmPackages:
    @storybook/addon-actions: 6.5.9 => 6.5.9 
    @storybook/addon-essentials: 6.5.9 => 6.5.9 
    @storybook/addon-interactions: 6.5.9 => 6.5.9 
    @storybook/addon-links: 6.5.9 => 6.5.9 
    @storybook/builder-vite: 0.1.36 => 0.1.36 
    @storybook/react: 6.5.9 => 6.5.9 
    @storybook/testing-library: 0.0.13 => 0.0.13 

More Context

It occurs intermittently

Storybook is run from the scripts/storybook/startStorybook/startStorybook.ts function.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
timurcataklicommented, Nov 4, 2022

I had the same issue and fixed it by 1- Renaming preview.js to preview.tsx as I am utilizing TS 2- Added `import React from “react”

import React from "react";
import { EnterpriseProvider } from "@company/dt-scl-core";
import ScopedCssBaseline from "@mui/material/ScopedCssBaseline";
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
import { customViewports } from "./customViewports";

export const parameters = {
  actions: { argTypesRegex: "^on[A-Z].*" },
  viewport: {
    viewports: { ...INITIAL_VIEWPORTS, ...customViewports },
  },
  controls: {
    matchers: {
      color: /(background|color)$/i,
      date: /Date$/,
    },
  },
};

export const decorators = [
  (Story) => (
    <EnterpriseProvider>
      <ScopedCssBaseline>
        <Story />
      </ScopedCssBaseline>
    </EnterpriseProvider>
  ),
];
6reactions
GuskiScommented, Jul 22, 2022

Having the same issue when trying to migrate to builder-vite. Once I trigger changes in preview.tsx, it runs fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to fetch dynamically imported module: - Stack Overflow
In my case, I use Vite in my React projects and every time the rollup generates the bundle chunks, it generates different hashes...
Read more >
[solved] Failed to fetch dynamically loaded module - help
Hi, so I have the following in a React component: import(`./some_path/${someMDXfile}.mdx`).then(MDX => { Content.current = MDX.default ...
Read more >
Error: Failed to fetch dynamically Dashboard imported module
After installing the latest Windows 10 update I get the following errors: 2022-07-18 09:43:15.9091 ERROR [null] Microsoft.JSInterop.
Read more >
Failed to fetch dynamically imported module : r/sveltejs - Reddit
Here's a startup project that has SSR with user data from Firebase: https://github.com/ManuelDeLeon/sveltekit-firebase-ssr It works as ...
Read more >
vite typeerror: failed to fetch dynamically imported module
Parsing error or encountered an exception. I believe this error is similar to the 'ChunkLoadError' ( which is also faced in many other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found