【发布时间】:2020-04-16 20:51:23
【问题描述】:
我正在尝试在生产版本中访问 Angular 前端。我将它包装在一个 servlet 中。当我尝试访问路径时,我得到以下信息:
http://localhost:8080/app/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>App</title>
<base href="/app/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="styles.bb3ec5518a780b95f31d.css"></head>
<body>
<app-root></app-root>
<script src="runtime-es2015.edb2fcf2778e7bf1d426.js" type="module"></script><script src="runtime-es5.edb2fcf2778e7bf1d426.js" nomodule defer></script><script src="polyfills-es5.df1101cc1e7b588877f8.js" nomodule defer></script><script src="polyfills-es2015.2987770fde9daa1d8a2e.js" type="module"></script><script src="scripts.539e754fcc6ef28df40f.js" defer></script><script src="main-es2015.b18181d4c0f94e66b234.js" type="module"></script><script src="main-es5.b18181d4c0f94e66b234.js" nomodule defer></script></body>
</html>
我在尝试加载 3 个 javascript 文件时得到以下结果。
加载模块脚本失败:服务器以非 JavaScript MIME 类型“”响应。根据 HTML 规范对模块脚本强制执行严格的 MIME 类型检查。 runtime-es2015.edb2fcf2778e7bf1d426.js:1
加载模块脚本失败:服务器以非 JavaScript MIME 类型“”响应。根据 HTML 规范对模块脚本强制执行严格的 MIME 类型检查。 polyfills-es2015.2987770fde9daa1d8a2e.js:1
加载模块脚本失败:服务器以非 JavaScript MIME 类型“”响应。根据 HTML 规范对模块脚本强制执行严格的 MIME 类型检查。 main-es2015.b18181d4c0f94e66b234.js:1
资源被解释为样式表,但使用 MIME 类型 text/plain: "http://localhost:8080/app/styles.bb3ec5518a780b95f31d.css" index.html:12 传输
【问题讨论】:
标签: angular-cli