How to run the Dist Folder on Local Machine in Angular 6+?

前端 未结 6 1426
无人共我
无人共我 2020-12-07 16:47

I am building the application in Angular6+, now I have run the command ng build --prod which gave me a dist folder. Now how to check or serve that

6条回答
  •  悲&欢浪女
    2020-12-07 17:05

    In my case I did next:

    Install http-server globally

    npm install http-server -g

    Then inside the project directory (in the terminal), I run

    http-server dist/[your-project-name]

    Now you can visit http://localhost:8080/index.html to view your application. But when I restart the browser page I have to add again /index.html into URL.


    It works in Angular 7.x.x version.

提交回复
热议问题