-
Notifications
You must be signed in to change notification settings - Fork 34
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
Expected a JavaScript module script but the server responded with a MIME type of "image/jpeg". #23
Comments
From the doc, I guess what it is saying is all images must be in public folder? Can anyone confirm? Any other way to make this work without putting all images into public folder? |
Hello @rosdi. You don't need to use the vite public folder. You can still using your About your first problem. Hmm, I think there's a problem in the examples with the configuration of
|
I haven't been able to get around this problem. I'm creating the react app with |
It's working now. Thanks @mattwcole |
Hi,
I cloned the Razor Pages example and changed it into React project. Then I import an image into my React component like so:
import profileImage from "../small-profile.jpg"
I couldn't get this image to be displayed in browser, in console log I can see this error:
Expected a JavaScript module script but the server responded with a MIME type of "image/jpeg". Strict MIME type checking is enforced for module scripts per HTML spec.
If I run this project in Release mode, the image gets resolved correctly and displayed in the browser, so there must be some configuration related to the Vite dev server.
Any clue what I did wrong?
The text was updated successfully, but these errors were encountered: