per live-server readme:
AJAX requests don’t work with the file:// protocol due to security restrictions, i.e. you need a server if your site fetches content through JavaScript.
- install
live-serverglobally
npm install -g live-server-
on project directory:
npx live-server -
view at
localhost:8080
I recently found a seemingly better alternative: serve is more actively maintained, smaller, and looks prettier on terminal too. I installed it globally,
npm install -g serveand simply run npx serve from inside my project directory. Sadly it doesn’t auto-reload pages (watch changes) and doesn’t have much feature (which is a feature, right? I guess?). Nonetheless, it covers the basics for me.