This is my Codespace playground. I am using it for learning, documenting, and experimenting.
Link: https://github.com/johnpapa/lite-server
-
first you need to install the package in your project
npm install --save-dev lite-server
... "devDependencies": { "lite-server": "^2.6.1", "typescript": "^4.8.4" } ...
-
after the installation is complete you need to create a script in your package.json file.
... "scripts": { "start": "lite-server", "test": "echo \"Error: no test specified\" && exit 1" }, ...
-
then you need to configure your lite-server to serve and watch the desire html file and others. For that purpose you need to create a bs-config.json file in your root directory.
{ "port": 8000, // set port "files": ["./src/**/*.{html,htm,css,js}"], // files to watch for changes "server": { "baseDir": "./base" } // path to the index.html file }