繁体   English   中英

为什么引导源地图没有加载到网站上

[英]Why is bootstrap source maps not loading on website

我有一个由 node.js 服务器提供的 index.html,不幸的是我在使用本地下载的引导程序库时无法加载引导程序; 当我使用从网络提供的引导程序时,它工作正常。

像这样包含引导程序时,网站可以正常工作

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>  

像这样包含引导程序时,网站不起作用

<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link type="text/json" href="node_modules/bootstrap/dist/css/bootstrap.min.css.map">
<script type="text/javascript" src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<link type="text/json" href="node_modules/bootstrap/dist/js/bootstrap.min.js.map">

当我查看节点服务器日志时,我发现源映射未能提供给客户端。

/node_modules/bootstrap/dist/js/bootstrap.min.js.map
_http_outgoing.js:464
    throw err;
    ^

TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value "undefined" for header "Content-type"
    at ServerResponse.setHeader (_http_outgoing.js:473:3)
    at C:\Users\Dwight\work\trainingwebsite/Server.js:109:20
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

我试过使用 bootstrap 4.0.0 和 4.4.1,但都表现出相同的行为。

为什么只有在我使用本地引导程序时才会发生这种情况? 我试过为源映射设置不同的类型,但我一直收到同样的错误......

更新:当我在 google chrome 设置上禁用源地图时,该站点可以通过本地引导程序正常加载。

尝试将其更改为:

<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css.map">
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script href="node_modules/bootstrap/dist/js/bootstrap.min.js.map">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM