我使用离子6和Angular 12,我在浏览器上测试我的应用程序,它的工作正常,问题是当我尝试在模拟器或手机上测试它.我在chrome上检查它,它给我这些错误,在闪屏后,它给了一个空白屏幕.
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. runtime.js
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. main.js
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. polyfills.js
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. vendor.js
这是我的index.html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Noz Terra</title>
<base href="./">
<meta name="color-scheme" content="light dark" />
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="icon" type="image/png" href="./assets/imgs/nozterra1.png" />
<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<app-root>
</app-root>
</body>
</html>
这是我编译时在www文件夹中生成的index.html文件(我认为这是问题的根源):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Noz Terra</title>
<base href="./">
<meta name="color-scheme" content="light dark"/>
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="msapplication-tap-highlight" content="no"/>
<link rel="icon" type="image/png" href="./assets/imgs/nozterra1.png"/>
<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<link rel="stylesheet" href="styles.css"></head>
<body>
<app-root>
</app-root>
<script src="runtime.js" type="module"></script><script src="polyfills.js" type="module"></script><script src="cordova.js" defer></script><script src="vendor.js" type="module"></script><script src="main.js" type="module"></script></body>
</html>
1条答案
按热度按时间cwdobuhd1#
将type=“模块”更改为type=“文本/javascript”,然后重试