mjs 파일 로드시 application/octet-stream 오류
페이지 정보
작성자
DocsArchives
작성일
2025.09.06 01:48
본문
Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.
이 에러 메시지는 브라우저가 <script type="module">로 불러온 자바스크립트 파일의 MIME 타입이 올바르지 않아서 발생합니다. 브라우저는 ES 모듈을 로드할 때 반드시 text/javascript MIME 타입이 필요하며, 서버에서 application/octet-stream으로 내려주면 로딩을 거부합니다.
보통 /etc/nginx/mime.types 파일에
text/javascript mjs; 추가
javascript 파일은 application/javascript js;
mjs 즉 javascript module 파일은 text/javascript mjs;
댓글 0