When you run npm run build:ssr, make sure it is performing the production build. Check your angular.json to verify that production optimizations are enabled for both the client and SSR build.
If you're running npm run build:ssr and it's not using the --prod flag, update your build configuration to include production optimizations.
In the angular.json, ensure you have the --prod flag set in the SSR build configuration:
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true
}
}
Update your build script (package.json), if necessary, to ensure ng build --prod is used. The build script for SSR may look like this:
json
Copy code
"scripts": {
"build:ssr": "ng build --prod && ng run your-app-name:server:production"
}
No comments:
Post a Comment