Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

巅峰赛中,打开商店页面会唤起浏览器,但浏览器有报错,无限Loading中 #265

Closed
cwbeta opened this issue Mar 21, 2022 · 17 comments
Labels
bug Something isn't working

Comments

@cwbeta
Copy link

cwbeta commented Mar 21, 2022

error
JS的错误显示试图获取的Javascript文件被服务器识别为text/plain类型:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.(assets/index.ac25b9a9.js)

:8300/assets/vendor.1a7cc180.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.(assets/vendor.1a7cc180.js)

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

报错浏览器版本:
Chrome 已是最新版本
版本 99.0.4844.82(正式版本) (64 位)

@NateScarlet
Copy link
Owner

python 什么版本

运行

py -3.8 -c "import mimetypes; print(mimetypes.types_map.get('.js'))" 显示什么

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

py -3.8 -c "import mimetypes; print(mimetypes.types_map.get('.js'))"显示“application/javascript”
python版本3.8.3

@NateScarlet
Copy link
Owner

奇怪 那说明给的类型是正常的 你用 edge 测试下

py -3.8 .\auto_derby\web\page_example.py 可以打开测试页面

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

嗯,Edge我也试过的,也是一样的结果。

@NateScarlet
Copy link
Owner

F12 找到报错 js 文件的响应头截图给我看下 像这样

图片

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

QQ截图20220321223325

@NateScarlet
Copy link
Owner

难道是你把js的文件类型关联过纯文本编辑器? 等我我单独搞个写死的版本你测试下

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

我试了把index.html里面的引用强行改成type="text/javascript"是能识别的,但是因为是module,不能这么写,就很尴尬

@NateScarlet
Copy link
Owner

测试一下这个版本 dceb0ec

@NateScarlet
Copy link
Owner

如果这个可以 那应该是系统设置的文件关联类型导致的 因为导入 python 的 http.server 库的时候会读取系统文件类型设置

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

这个版本运行example还是同样的报错_(:з」∠)_

@NateScarlet
Copy link
Owner

可能是缓存 用 Ctrl+F5 强制刷新看看

@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

可以了!那估计真是这个问题,我看起来js文件还是js格式,很奇怪:
QQ截图20220321224847

@NateScarlet
Copy link
Owner

那你运行 py -3.8 -c "import mimetypes; import http.server; print(mimetypes.types_map.get('.js'))" 应该会返回 text/plain

python 会读注册表的这个 “Content Type” 设置

图片

@NateScarlet NateScarlet added the bug Something isn't working label Mar 21, 2022
@cwbeta
Copy link
Author

cwbeta commented Mar 21, 2022

确实,显示text/plain,不知道是被什么软件改了
QQ截图20220321225608

@NateScarlet
Copy link
Owner

v1.17.1 修复了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants