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.

리버 river·2024년 3월 3일
0

트러블 슈팅

목록 보기
1/3


git pages에 배포했는데 이런 에러를 마주했다.
이 메시지는 "예상한 것은 JavaScript 모듈 스크립트였지만 서버가 'text/css' MIME 유형으로 응답해서 생긴 에러" 라는 뜻이다.


크롬 네트워크 창에서 확인해보니
index.html에서 link 태그로 importcss들은 stylesheet으로 잘 불러져오고있지만 step2-index.js 에서 import를 한 css들은 stylesheet이 아닌 script로 불러와져있었다.

// 수정 전
import './web/css/index.css';
import './web/css/reset.css';

import './controller/lottoWebGameController.js';
// 수정 후 
import './controller/lottoWebGameController.js';

step2-index.html에서 css import들은 삭제했더니 해결되었다.

profile
프론트엔드 개발자

0개의 댓글

관련 채용 정보

Powered by GraphCDN, the GraphQL CDN