While rendering a static image, below error is coming:
Failed to load module script: Expected a JavaScript-or-Wasm 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.
code :
import noProd from “../asset/search-filter-trim.png”
<Image src={noProd} />
If you keep your files inside the src directory they will be imported correctly, please don’t use a root-level assets directory as we do not ship these to production
@steve-t-shopify I’m currently facing the same issue trying to import images directly from src.
Example on src/test.tsx with the image also on src/image.png:
import testImage from "./image.png"
import { Image } from "@shopify/shop-minis-react"
export default function Test() {
return <Image src={testImage} />
}
This code looks correct and works fine for me - if you’re still hitting this after npx shop-minis upgrade can you:
I belive it’s the same problem from this thread since it’s also on an android emulator and shows the same behavior. I’ll wait for the next week update for testing.