Vue automatically opens the browser as Google after using the npm run dev command

Article directory

need

After vue starts, I want it to automatically open the specified browser (Google) and set the IP address and port number to be opened

analyze

  1. package.json
    open the package.json file plus --open chrome
  "scripts": {
    
    
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --open chrome --host  localhost",
    "start": "npm run dev",
    "build": "node build/build.js"
  },

insert image description here

  1. index.js
    opens the index.js file and sets the browser to open automatically

insert image description here

Guess you like

Origin blog.csdn.net/qq_53810245/article/details/131689619