记一次诡异的bug,The resource was preloaded using link preload but not used within a few seconds
一、问题描述做一个vue项目的时候,突然页面打不开了,空白页,什么都不显示报这个错The resource http://localhost:8082/js/index.js was preloaded using link preload but not used within a few seconds from the window’s load event. Please make sur
·
一、问题描述
做一个vue项目的时候,突然页面打不开了,空白页,什么都不显示
报这个错
The resource http://localhost:8082/js/index.js was preloaded using link preload but not used within a few seconds from the window’s load event. Please make sure it has an appropriate as
value and it is preloaded intentionally.
二、解决问题
然后我寻思也没有用这个文件呀,后面找呀找呀,发现我在打包的HTML模板里加了一行注释
<!--<body><script type="text/javascript" src="../monitorScreen/js/index.js"></script></body>-->
完整HTML如下
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>哈哈哈哈</title>
</head>
<body>
<!--<noscript>-->
<!--<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>-->
<!--</noscript>-->
<div id="app"></div>
<!-- built files will be auto injected -->
<!--<body><script type="text/javascript" src="../monitorScreen/js/index.js"></script></body>-->
</body>
</html>
原来是我打包以后路径不对,我就粘贴了一下可以跑通的路径放在这里,注释掉了,没想到body标签这么强大,注释掉也可以影响,成为一个使页面空白的bug,而且把body换成head等其他标签,都不会出现这个问题,真的是!!!unbelievable!!
把这个注释删掉就可以啦!
由于实在是很诡异,超出我有限的认知水平,打破了我固有的思维模式,所以特地记录一下。
更多推荐
已为社区贡献1条内容
所有评论(0)