'How to remove Angular Universal on angular project
I enabled angular universal on my project . 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?
Solution 1:[1]
This worked for me (from "@nguniversal/express-engine": "^13.1.0",
):
- Use
npm
to remove these dependences:
npm uninstall @nguniversal/express-engine
npm uninstall @nguniversal/builders
npm uninstall express
npm uninstall @types/express
- 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!
- Delete not necessary code of your configuration files:
- From package.json, delete 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:
- From app.module.ts, delete withServerTransition:
* From _app-routing.module.ts_, this is not needed:
- 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:
Solution 2:[2]
Based on Angular documentation on the following link 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 :-
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sangarllo |
Solution 2 | laserany |