将tdweb导入我的离子应用程序会导致错误:由于MIME类型“ text / html”不匹配,worker.js的资源被阻止

问题描述

我已使用npm install tdweb从TDLib安装了tdweb到我的ionic 3应用程序。但是,当我导入tdweb并运行ionic serve对其进行测试之后,Firefox中将显示以下错误

Cannot GET ./130f0ecf36ff90c87239.worker.js
The resource from “http://localhost:8101/130f0ecf36ff90c87239.worker.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

我无法继续进行,因为我从TDLib获得的唯一更新是authorizationStateClosed。我已经检查了telegram-react中的示例,可以通过将node_modules中的文件复制到public来避免该示例。似乎它仅在反应中起作用,而不适用于离子/角。有人对此有想法吗?

声明网络工作者的代码

tdweb.js

...
/***/ }),/* 7 */
/***/ (function(module,exports,__webpack_require__) {

module.exports = function() {
  return new Worker(__webpack_require__.p + "130f0ecf36ff90c87239.worker.js");
};
...

Http响应标头

HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 169
Date: Thu,10 Sep 2020 16:06:20 GMT
Connection: keep-alive

Http请求标头

GET /130f0ecf36ff90c87239.worker.js HTTP/1.1
Host: localhost:8101
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip,deflate
Connection: keep-alive
Referer: http://localhost:8101/

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)