You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using vites static asset import ( "vite": "^5.2.11",), i get this error when trying to import images with vite static assets.
Failed to fetch dynamically imported module: components/MyModule.tsx
MyModule.tsx looks like this:
import myImage from "/images/myImage.png?url"
export function MyModule() {
return <img src={myImage} alt="" />;
}
The console has this error:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "image/png". Strict MIME type checking is enforced for module scripts per HTML spec.
it seems to be trying to load this as a script/module but its actually an image, the browser throws an error and then storybook crashes and cannot import the entire module.
Happens for svgs, images, etc
To Reproduce
Unable to reproduce in stackblitz, but showed example above in the description.
Describe the bug
When using vites static asset import ( "vite": "^5.2.11",), i get this error when trying to import images with vite static assets.
MyModule.tsx looks like this:
The console has this error:
it seems to be trying to load this as a script/module but its actually an image, the browser throws an error and then storybook crashes and cannot import the entire module.
Happens for svgs, images, etc
To Reproduce
Unable to reproduce in stackblitz, but showed example above in the description.
System
Additional context
Does not happen in the vite app, only in storybook with vite.
The text was updated successfully, but these errors were encountered: