How to serve angular2 application without browser

In my package.json , I have the following:

 ... "scripts": { "tsc": "tsc", "tsc:w": "tsc -w --outDir build", "lite": "lite-server", "start": "concurrent \"npm run tsc:w\" \"npm run lite\" " }, ... 

and I was wondering how can I run the application using " npm production " or something like that?

I would like to prevent the launch of browsers: I just tried with several users, and it was fun that they scroll "as one". This also happens in different browsers (but not using different tabs).

+5
source share
3 answers

You can use serve instead of a lite server.

+7
source

Use npm start . In a recently installed Angular application with ng new <name_of_app> , the package.json file has settings for this

 "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" } 

Thus, when using npm start ng serve will be executed, and browser synchronization will not be performed by browsers

0
source

you can use http-server (npm install -g http-server ) then in the project directory http-serve -p [port]

-1
source

Source: https://habr.com/ru/post/1247046/


All Articles