I'm working on Angular 9.1.4 node 14.0.
Now I'm facing a trouble which is whenever trying to run
ng serve
its taking long time to start. I'm trying to compile a theme I have got from themeforest. no installation issue at all with npm install which all works fine and I also updated all the packages in packages.json as well.
Still the serve command is very slow
This is mostly because of bulky source map files. When you do ng serve , Angular serves the app from memory instead of the dist folder (the file system). This means the entire code (along with map files) will be loaded into the system's memory and this is the main reason why your system or IDE getting slow.
11), ng serve takes about 1 minute to serve the app, but the ng-serve --source-map=false takes somewhere from 10 to 30 seconds.
ng serve is a great command to use when developing your application locally. It starts up a local development server, which will serve your application while you are developing it. It is not meant to be used for a production environment.
Most of the time ng serve takes too long because of @angular-devkit
downgrading the version might work. Since you are using angular 9 you can enable ivy compilation in tsconfig file by adding
"angularCompilerOptions": { "enableIvy": true }
You can specify the --source-map=false
attribute for Angular to load only the stuff that it needs, and will recompile only those parts of your application, that have been modified.
ng serve --source-map=false
In my case (Angular v.11), ng serve
takes about 1 minute to serve the app, but the ng-serve --source-map=false
takes somewhere from 10 to 30 seconds. Moreover, changes are applied much more faster.
Use the --verbose option to see what's going wrong behind the scenes:
ng serve --verbose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With