error 1:Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/css”. Strict MIME type checking is enforced for module scripts per HTML spec.
error 2:Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “application/json”. Strict MIME type checking is enforced for module scripts per HTML spec.
I found these two errors.
i tried ‘type’ attribute in script element tag.
.
but it couldn’t work.
i was expecting that it would import the products of products.json file into the main.js by using the import statement as follows:
import products from “./api/products.json”;
console.log(products);
Narotam kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.