Using NPM live server to watch HTML files. To avoid CORS issues and to work more quickly when developing a static HTML site locally, use a local server like live-server
for development.
- Install live-server
npm install -g live-server
- Serve the project. Navigate to the root directory of your project and start live-server:
live-server
This will start a local server and open your project in the browser. The local server will handle the requests properly, avoiding any CORS issues.