Vite + Build + Root
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
Streamlit에 Google login 컴포넌트를 만들어 넣고 있는데, URL로 불러오면 잘 보이는 것이 build해서 File로 serving하면 위와같은 메시지를 뿌린다.
뭘까? 한참을 읽어보고 network tab에서 읽어들이는 위치를 찾아보고 나서 이해가 된다.
http://localhost:9020/component/login_component.login_component/index.html?streamlitUrl=http%3A%2F%2Flocalhost%3A9020%2F
이 녀석이 Vite에서 생성된 index.html을 Streamlit에서 호출하는 녀석인데, Build된 녀석은 나름 저 혼자 돌아가는줄 알고 있을터이니, 빌드한 결과가 “/”로 잡혀있을 것이 분명했다.
![]() |
---|
index.html에 .을 하나 찍어주자 |
수정해서 잘 되는 것을 확인하고는, 매번 빌드 할 때마다 바꿔줄수 없으니 설정을 변경한다.
![]() |
---|
vite.config.ts |
Enjoy Reading This Article?
Here are some more articles you might like to read next: