ParcelJS for ReasonML无法正确执行热加载

使用包裹已经有一段时间了,但这是我第一次尝试使用ReasonmL(React-Hooks主题)。刚刚尝试了通用bsb -init foobar-主题原因钩子

包裹似乎捆绑得很好(即,如果我将文件夹复制到Web服务器,则可以打开index.html,并且一切正常。(http://localhost/folder/index.html

问题出在

Server running at http://localhost:1234 
√  Built in 1.55s.

当我进入localhost:1234时,在加载时出现Chrome的以下错误。

(请注意,它说的是index.html的内容(或者是index.bs.b68b9b3.js))(顺便说一句:Chrome浏览器显示的JS文件很好,就是index.html的内容

ParcelJS for ReasonML无法正确执行热加载

这是/ dist文件夹的内容

ParcelJS for ReasonML无法正确执行热加载

这是我用来构建的npm脚本:

    "pack": "node_modules/.bin/parcel src/index.html --public-url ./",

位于src / index.html的Index.js

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Web Dashboard</title>
</head>

<body>
    <script>
        // stub a variable ReactJS checks. ReactJS assumes you're using a bundler,NodeJS or similar system that provides it the `process.env.NODE_ENV` variable.
        window.process = {
            env: {
                NODE_ENV: 'development'
            }
        };
    </script>

    <script src="Index.bs.js"></script>
</body>

</html>

您的环境

windows 10 “依赖关系”:{ “ react”:“ ^ 16.8.1”, “ react-dom”:“ ^ 16.8.1”, “原因反应”:“> = 0.7.0” }, “ devDependencies”:{ “ bs-platform”:“ ^ 7.0.1”, “ moduleserve”:“ ^ 0.9.0”, “包裹捆扎机”:“ ^ 1.12.4”

eunsike 回答:ParcelJS for ReasonML无法正确执行热加载

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2709805.html

大家都在问