加载我的索引 html 文件与使用 http-server 有什么区别?

What is the difference between loading my index html file vs. using http-server?

我正在学习编码并使用过 npm、webpack 和 http-server。我通常使用 http-server,然后打开本地主机来查看我通过 React 所做的更改,这些更改最终出现在 index.html。但是我注意到,如果我只是在 Chrome 或其他浏览器中打开 index.html 文件,这也有效。打开http-server有什么意义?

有些情况需要服务器,例如 ajax。许多事情不需要服务器,但过了一段时间后,开发人员就会习惯使用本地服务器。