简体   繁体   English

如何删除 angular 项目上的 Angular Universal

[英]How to remove Angular Universal on angular project

I enabled angular universal on my project.我在我的项目中启用了 angular 通用。 I would like to remove it completely now.我现在想完全删除它。 I tried to remove the following files我试图删除以下文件

/server.ts
/webpack.server.config.js
/src/tsconfig.server.json
/src/main.server.ts
/src/app/app.server.module.ts
and remove server section in angular.json

but, It has not removed completely.但是,它还没有完全删除。

Is there any command to remove it completely?有什么命令可以完全删除它吗?

This worked for me (from "@nguniversal/express-engine": "^13.1.0", ):这对我有用(来自"@nguniversal/express-engine": "^13.1.0", ):

  1. Use npm to remove these dependences:使用npm去除这些依赖:
npm uninstall @nguniversal/express-engine
npm uninstall @nguniversal/builders
npm uninstall express
npm uninstall @types/express
  1. Remove from your solution these files:从您的解决方案中删除这些文件:
./server.ts    
./tsconfig.server.json    
./src/main.server.ts
./src/app/app.server.module.ts
// Delete `*webpack.server` config file if exists!
  1. Delete not necessary code of your configuration files:删除配置文件中不需要的代码:
  • From package.json , delete ssr-scripts:package.json删除 ssr-scripts:
 "dev:ssr": "ng run info-rincon:serve-ssr",
 "serve:ssr": "node dist/functions/server/main.js",
 "build:ssr": "ng build && ng run info-rincon:server:production",
 "prerender": "ng run info-rincon:prerender",
  • From angular.json , delete "server" or "prerender" sections:angular.json中,删除“服务器”或“预渲染”部分:

移除 server、server-ssr 和 prerender 部分

  • From app.module.ts , delete withServerTransition :app.module.ts中删除withServerTransition

移除 withServerTransition 区域

* From _app-routing.module.ts_, this is not needed:

在此处输入图像描述

  1. If you have been using firebase, @angular/fire, Google Cloud Functions or something like that... perhaps you also need to search and delete more code:如果您一直在使用 firebase、@angular/fire、Google Cloud Functions 或类似的东西……也许您还需要搜索并删除更多代码:

移除函数配置

Based on Angular documentation on the following link https://angular.io/guide/universal基于以下链接上的 Angular 文档https://angular.io/guide/universal

looking up at the second section of the page (Universal tutorial) it will show you the files that are created using angular universal which are :-查看页面的第二部分(通用教程),它将向您展示使用 angular Universal 创建的文件,它们是:-

src/index.html
src/main.ts    
src/main.server.ts    
src/style.css    
app/... app.server.module.ts    
server.ts    
tsconfig.json    
tsconfig.app.json    
tsconfig.server.json    
tsconfig.spec.json    
package.json    
webpack.server.config.js

i would delete these files completely and/or delete the sections in these files that are angular-universal related我会完全删除这些文件和/或删除这些文件中与角度通用相关的部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM