帖子
帖子
用户
博客
课程
显示全部楼层
1
帖子
0
勋章
14
Y币

[开发工具] 访问html页面时报了个错

[复制链接]
发表于 2022-1-15 09:52:31
[2022-1-15 9:50:7][ERROR] Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec. at vendor.8565cc0e.js:0
服务器响应的非JavaScript MIME类型,检查后端输出的JS文件 MIME类型是否正确为;Content-Type: application/javascript;
解决了吗

解决了吗
1
帖子
0
勋章
14
Y币
没解决呢
我就是把用Vite开发的单页应用打包后放到了 html目录下 然后就报了这个错
App都调试不起来 但使用Vue-Cli创建的项目就可以正常调试
1
帖子
0
勋章
14
Y币
api.openFrame({
            name: 'main',
            url: 'html/index.html', // 这个地址改成了vite打包后的html页
            bounces: true,
            rect: { // 推荐使用Margin布局,用于适配屏幕的动态变化
                marginTop: headerH, // main页面距离win顶部的高度
                marginBottom: footerH, // main页面距离win底部的高度
                w: 'auto' // main页面的宽度 自适应屏幕宽度
            }
        });
// 打包后在html页面里生成的js引用
<script type="module" crossorigin src="./assets/index.559fd86e.js"></script>
<link rel="modulepreload" href="./assets/vendor.070c0b9a.js">
// APICloud控制台输出日志
[2022-1-18 22:43:56][ERROR] Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec. at vendor.070c0b9a.js:0
[2022-1-18 22:43:56][ERROR] Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec. at index.559fd86e.js:0
JS 响应输出有问题,你可以把JS文件放服务器试试就知道了
您需要登录后才可以回帖 登录

本版积分规则