如何在angular2应用程序中显示应用程序版本?该版本应从package.json文件中获取
{
"name": "angular-app",
"version": "0.0.1",
...
}
Run Code Online (Sandbox Code Playgroud)
在角1.x,我有这个HTML:
<p><%=version %></p>
Run Code Online (Sandbox Code Playgroud)
在angular2中,这不会呈现为版本号,而是按原样(<%=version %>而不是0.0.1)打印.
我在一个全新的 Angular 10 项目的资产文件夹中有一个基本的 JSON 文件。
Angular CLI:10.0.1 节点:14.5.0 操作系统:win32 x64 TSC 版本 3.9.5。在我的 tsconfig.json 我有
"compilerOptions": {
"module": "commonjs",
"resolveJsonModule": true,
"esModuleInterop": true
}
Run Code Online (Sandbox Code Playgroud)
I have restarted vscode multiple times, and tried compiling from the vscode terminal, a powershell window, and a bash terminal, all returning the same message: "Consider using '--resolveJsonModule' to import module with '.json' extension". I have tried compiling with multiple combinations of different options. At this point I'm wondering if I should restart this project …