簡體   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