search

Home  >  Q&A  >  body text

node.js - What is the difference between npm run dev and using virtual host configuration?

Executing npm run dev in the directory where package.json is located will start localhost:8080. After being modified by the watch file, it will automatically recompile and refresh the browser.

At this time, use nginx to configure a virtual host (such as app.dev) to point to this directory, update some files, and trigger recompilation. localhost:8080 The page accessed by the port will be modified synchronously, and app.dev The page you visit is still the same as before the modification.

Why is this?

怪我咯怪我咯2783 days ago607

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:26:12

    The service started in npm run dev mode accesses the content in the cache after compilation. The compiled content is not synchronized to the hard disk.
    When accessed through nginx, files on the hard disk are accessed, so app.dev 访问的页面还是修改前的样子

    will appear

    reply
    0
  • Cancelreply