What Is The Difference Between Ng Build And Ng Serve? - LinkedIn

Agree & Join LinkedIn

By clicking Continue to join or sign in, you agree to LinkedIn’s User Agreement, Privacy Policy, and Cookie Policy.

Sign in to view more content

Create your free account or sign in to continue your search

Sign in

Welcome back

Email or phone Password Show Forgot password? Sign in

or

By clicking Continue to join or sign in, you agree to LinkedIn’s User Agreement, Privacy Policy, and Cookie Policy.

New to LinkedIn? Join now

or

New to LinkedIn? Join now

By clicking Continue to join or sign in, you agree to LinkedIn’s User Agreement, Privacy Policy, and Cookie Policy.

Skip to main content
What is the difference between ng build and ng serve?

ng build — This command builds your app and deploys it

ng serve — This command builds, deploy, serves and every time watches your code changes. if find any change in code it builds and serves that code automatically.

How do Angular builds?

After coding our Angular apps using TypeScript, we use the Angular CLI command to build the app.

ng build command compiles the application into an output directory and the build artifacts will be stored in the dist/ directory.

Internal Process

1. Angular CLI runs Webpack to build and bundle all JavaScript and CSS code.

2. In turn Webpack calls the TypeScript loaders which fetches all .ts file in the Angular project and then transpile them to JavaScript i.e to a .js file, which browsers can understand.

What is the sequence of calling the build process?

Angular CLI first calls Angular built-in compiler written in TypeScript => then calls the TypeScript Transpiler => then calls the Webpack to bundle and store in the dist/ directory.

How Angular runs

When the build is completed, all our app’s components, services, modules etc are transpiled to JavaScript .js files that are used to run the Angular application in the browser.

Like Like Celebrate Support Love Insightful Funny Comment
  • Copy
  • LinkedIn
  • Facebook
  • Twitter
Share

To view or add a comment, sign in

No more previous content
  • Challenges in Developing Spring Boot Microservices with Spring Cloud

    Challenges in Developing Spring Boot Microservices with Spring Cloud

    Jul 14, 2024

  • Microservice Challenges and Solutions

    Microservice Challenges and Solutions

    Apr 28, 2024

  • NGINX Plus

    NGINX Plus

    Apr 24, 2024

  • INTRODUCTION

    INTRODUCTION

    Apr 23, 2024

  • Clean Architecture

    Clean Architecture

    Feb 5, 2024

  • How to Deploy Microservices Using Serverless Architecture?

    How to Deploy Microservices Using Serverless Architecture?

    Jan 10, 2024

  • Ways to Visualize Geospatial Data in a Web Browser

    Ways to Visualize Geospatial Data in a Web Browser

    Jan 8, 2024

  • Java Collections Framework & Time Complexity Of Operations

    Java Collections Framework & Time Complexity Of Operations

    Oct 5, 2023

  • Improve API Performance

    Improve API Performance

    Oct 3, 2023

  • Monoliths vs Microservices

    Monoliths vs Microservices

    Sep 14, 2023

No more next content See all

Insights from the community

  • Ext JS What are the pros and cons of using Sencha Cmd vs Webpack for code splitting and lazy loading in Ext JS?
  • Front-end Development How can you test and debug Vue components more effectively?
  • Website Building How do you test and validate your webpack and babel configuration and output?
  • Jasmine Framework What are the benefits and drawbacks of using jasmine mocks over real objects?
  • Ionic Framework How do you structure your Ionic projects with TypeScript?
  • JavaScript Libraries What are some common challenges or pitfalls of code splitting with webpack and how do you overcome them?
  • Website Building What are the benefits and drawbacks of using webpack and babel together?
  • Web Development Here's how you can troubleshoot unexpected issues in your code.
  • Software Development What is your process for ensuring third-party tools and libraries are reliable?
  • Operating Systems How can you use JavaScript to design OS user interfaces and experiences?
Show more Show less

Others also viewed

  • Lazy Loading React Components (with react.lazy and suspense)

    Fabio Lanza 7mo
  • Why Are They Called ‘Reducers’?

    Idan Levian 5mo
  • Alpine.js: What do we know? How does it compare? Who's using it?

    Ed Keenan 1y
  • useState() and Crafting Your Custom State Hook

    Shankar J. 1y
  • Aurelia Overview

    Jon Bonso 7y
  • Getting Started with React and Node.js: Building Your First Full-Stack Application

    Nader Dweik 1mo
  • Component vs PureComponent vs Stateless Functional Component in React

    Nihal Kaul 4y
  • Pro Tip: Use a unique id generator

    Anthony Delorie 1y
  • Exploring ReactJS useState Hook: Simplifying State Management

    ZestGeek Solutions Pvt Ltd 10mo
  • Component in ReactJS

    Jaya Dhamat Paliwal 1y
Show more Show less

Explore topics

  • Sales
  • Marketing
  • IT Services
  • Business Administration
  • HR Management
  • Engineering
  • Soft Skills
  • See All

Từ khóa » Ng Run Vs Ng Serve