Skip to content

Instantly share code, notes, and snippets.

@ayyash
Created October 2, 2022 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayyash/32b17ddcf59bf662984bc7ec2d29cbba to your computer and use it in GitHub Desktop.
Save ayyash/32b17ddcf59bf662984bc7ec2d29cbba to your computer and use it in GitHub Desktop.
Minimun required specs for Angular Prerender
{
"newProjectRoot": "projects",
"projects": {
"cr": {
// ...
"prefix": "cr",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
// ... the usual options for browser
},
"configurations": {
"production": {
"outputPath": "./host/client/",
"index": "src/index.html",
// ... other
}
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "./host/server/",
"main": "server.ts",
"tsConfig": "tsconfig.server.json",
// ...
}
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": false,
// ...
}
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"browserTarget": "cr:build:production",
"serverTarget": "cr:server:production",
"guessRoutes": false, // guessing outputs all routes
"routes": [
"/projects/create",
"/projects/1",
"/example",
"/" // this will generate index.original.html in the client folder
]
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment