我想在进行生产构建时创建一个 index.jsp 文件而不是 index.html。这个奇怪的要求是为了捕获我们将从其他 Oracle 身份验证管理器获取的 header 部分,因此我想从 index.jsp 加载我的应用程序。我的 index.jsp 应该看起来像这样
<%@ page language="java" import="java.util.*" session="true" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CardEncryption</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.3ff695c00d717f2d2a11.css"></head>
<body>
<app-root></app-root>
<script type="text/javascript" src="runtime.06daa30a2963fa413676.js"></script><script type="text/javascript" src="polyfills.9a8743e2009b1e7b1fbd.js"></script><script type="text/javascript" src="main.dcf4ad6dff6130812df3.js"></script></body>
</html>
任何这样做的建议。
最佳答案
我想您在进行生产构建时只需要 index.jsp
。开发过程应该还是使用index.html
在那种情况下你应该
- 在与您的
index.html
文件相同的目录中创建一个index.jsp
文件(因此您同时拥有这两个文件)。 - 通过向您的生产配置添加索引属性来更新您的
angular.json
文件的生产配置,如下所示:
当您使用 --prod
构建时,这将确保它使用 index.jsp
,但仍使用 index.html
进行开发.
关于node.js - 使用 index.jsp 而不是 index.html 构建 Angular 生产环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55758545/