javascript - webpack-dev-server is not an internal command, why can it be configured through scripts?
怪我咯
怪我咯 2017-05-19 10:42:43
0
3
541

webpack-dev-server is not an internal command, and then after configuring the scipt of package.json,
npm run server can start the server. Why is this?

scripts "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    **"server":"webpack-dev-server"**
  },

The following is the configuration of my package.json

{
  "name": "demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "server":"webpack-dev-server"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-loader": "^6.4.1",
    "css-loader": "^0.28.0",
    "style-loader": "^0.16.1",
    "url-loader": "^0.5.8",
    "webpack": "^2.3.3",
    "webpack-dev-server": "^2.4.2"
  }
}
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
为情所困

You can understand it this way, npm run命令会开启一个新的shell,默认把node_modules/.bin添加到环境变量$PATH
所以你npm run运行的webpack-dev-server来自当前项目的node_modules/.binunder the directory

迷茫

Have you tried this webpack-dev-server package? There is a command

大家讲道理

Then how should I set it up to use webpack-dev-server directly?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template