React Router에서 Path Parameter로 동적 라우팅을 처리하면 계속 다음과 같은 에러가 발생하며 페이지가 제대로 표시되지 않았다.
Refused to execute script from 'http://localhost:3000/path/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
어디선가 경로 설정을 잘못해서 생긴 문제라는 건 직감할 수 있었지만, 서치를 해도 너무 다양한 상황이 존재해 정확한 해결 방법을 파악하기 어려웠다.
output: {
publicPath: '/',
...
}
나의 경우 webpack.config.js에 publicPath를 설정하여 문제를 해결하였다.
👇🏻 참고
MIME type ('text/html') is not executable, and strict MIME type checking is enabled
Refused to execute script from 'http://localhost:8080/edit/bundle.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. I am using react-router and I...
stackoverflow.com
'개발 > 나의 오류 일지' 카테고리의 다른 글
[나의 오류 일지] styled-components 글자 깜빡임 현상 (FOUT) (0) | 2024.08.04 |
---|---|
[나의 오류 일지] Typescript emitted no output (0) | 2024.07.14 |
[나의 오류 일지] __dirname is not defined (0) | 2024.07.14 |