我一直在尝试集成PartyTown,这是一个使用Web Workers来执行Javascript而不是主线程的框架,虽然PartyTown在VScode托管的实时服务器中运行得非常好,但当试图测试该项目是否在手机中运行良好时,它在GitHub中并没有像预期的那样运行。
这是我想要加载的代码,以及JS脚本:
<!-- PartyTown (used to relieve the main thread from the javascript executions) -->
<script src="~partytown/partytown.js"></script>
<!-- PartyTown (used to relieve the main thread from the javascript executions) -->
<!-- General Functions -->
<script defer type="text/partytown" src="../javascript/app.js"></script>
<!-- General Functions -->
<!-- Install Cookies JavaScript Library -->
<script type="text/partytown" rel="preload" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js"></script>
<!-- Install Cookies JavaScript Library -->
<!-- Redirect to Correct Language Versions JavaScript -->
<script type="text/partytown" eager src="../javascript/multilanguage-serve.js"></script>
<!-- Redirect to Correct Language Versions JavaScript -->
<!-- Font Awesome Library -->
<script type="text/partytown" defer src="https://kit.fontawesome.com/82a93eb8fe.js" crossorigin="anonymous"></script>
<!-- - Font Awesome Library -->
我确信这些文件存在于GitHub中,因为当我从inspect元素选项卡编辑html并删除PartyTown脚本和type=“text/partytown”属性时,脚本会按预期运行
1条答案
按热度按时间lx0bsm1f1#
转到DevTools的network选项卡,检查http请求在哪里查找脚本。试着找到解决这个问题的方法。我所做的是,我改变了
partytown.js
和它查找所需库文件的目录。我把它的搜索指向我想要的文件夹,脚本工作得很好。希望这有帮助