ng serve
ng build or ng build --dev
- Compiles and serves the application from memory
- Does not write the build files to the disk so we cannot use it for deploying our application on a different server.
- Typically used to run the application on the local development machine
- Cannot be used for deploying the build to another server (Ex. Testing, Staging or Production server) i.e. if we want to deploy your application to a test, staging or production server we cannot use ng serve command.
- Used for deploying code in differnet servers.
- Compiles the application to the "dist" folder
- Can be used to produce both development & production builds
- Typically used to deploy the application on another server
- The bundle files (inline, main, polyfills, styles, & vendor) generated by the development build are not optimized, meaning the bundles are not minified or treeshaked to remove the code that is not being used.
- If you want to deploy the application to a server, copy the contents of the "dist" folder to a folder on the server.
ng build or ng build --prod
- Used for deploying code in production.
- Compiles the application to the "dist" folder and copies all the build files into that folder.
- The ng build command does a development build, not a production build.
- production code is optimized.
- Uses techniques like Ahead-of-time (AOT) compilation, minification, uglification, and tree-shaking implemented.
- Sizes of the bundles the production build very less compared to the dev build.
- If you want to deploy the application to a server, copy the contents of the "dist" folder to a folder on the server.
No comments:
Post a Comment