Why should I use npm run dev to display the page?

at the beginning of writing a simple page, you only need to open index.html to display the page content directly. Now you are learning Vue.js, to use webpack to build a project. Why should you use npm run dev to display the page content in such a project? directly opening index.html does not show anything. There is obviously a js file introduced in index, why the js file cannot be displayed even if you click on it. I"m confused about exactly what npm run dev does, and the difference between displaying the page in this way and opening the html directly in the first place. Beginners also look forward to your advice.

Mar.09,2021

"scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "build": "node build/build.js"
  }

running npm run dev packages the file according to the relevant configuration files of the development environment and starts webpack-dev-server-, a small node-based http server. You can find this command in npm's configuration file package.json.

it is recommended that the landlord first have an in-depth understanding of the related concepts of front-end engineering, modular development, nodejs, npm and webpack.

Menu