git pages에 배포했는데 이런 에러를 마주했다.
이 메시지는 "예상한 것은 JavaScript 모듈 스크립트였지만 서버가 'text/css' MIME 유형으로 응답해서 생긴 에러" 라는 뜻이다.
크롬 네트워크 창에서 확인해보니
index.html
에서 link
태그로 import
한 css
들은 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들은 삭제했더니 해결되었다.