Reputation: 1147
It is taking almost 10-15 minutes to build the project in the production mode and the dist folder size is 32MB
these are the production options that I am using:-
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
I am running following command to build the project:-
node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --source-map=false --named-chunks=false --statsJson=false
PS: I already tried with Ivy. It is not supporting legacy code hence, failing the build.
Any help will be much appreciated. thanks.
Upvotes: 4
Views: 6396
Reputation: 5894
Here are some basic steps
dist/
version of your libsIf you do all of this and your prod builds are still over 10 minutes, I'd suggest looking into Nx incremental builds.
If you get that all set up and your builds are still too slow and you have multiple teams working on your app, then you may want to look into Module Federation.
Upvotes: 3
Reputation: 2699
You could try webpack Bundle Analyzer to see if you have some large bundles generated...
https://alligator.io/angular/bundle-size/
Upvotes: 0
Reputation: 14
you can disable "optimization", "aot" and "buildOptimizer" for faster build. but that may make the dist folder size even worse.
Upvotes: -1
Reputation: 2430
Check the stack answer of the Previous Questions
ng build --source-map=false
Hope this will helps... !!
Upvotes: 0