You can use http-server to run your Angular App.
First of all generate a build using the command
1)
ng build
This will create a dist folder in your directory structure.
When you run the ng build command, it creates a /dist folder. Here are the files and their associated sizes after running the above command.
Note: Your file sizes will vary based on your project.
As you can see, we have a massive vendor.bundle.js file, because when you run ng build without specifying the production environment, it doesn't make use of uglifying and tree-shaking.
2)
ng build --prod
So, adding the production flag reduced the bundle from around 3.6 MB to 423 KB, which is nearly an 83% reduction.
After this, run
http-server ./dist, which will start serving your project from dist folder.
Make sure you have installed http-server globally using
npm install http-server -g


Comments
Post a Comment