Rumah > Soal Jawab > teks badan
webpack-dev-server bukan perintah dalaman, dan kemudian selepas mengkonfigurasi scipt package.json,
npm run server boleh memulakan pelayan Mengapa?
scripts "scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
**"server":"webpack-dev-server"**
},
Berikut ialah konfigurasi pakej saya.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"
}
}
为情所困2017-05-19 10:44:43
Anda boleh memahaminya dengan cara ini, npm run
命令会开启一个新的shell
,默认把node_modules/.bin
添加到环境变量$PATH
所以你npm run
运行的webpack-dev-server
来自当前项目的node_modules/.bin
di bawah direktori
大家讲道理2017-05-19 10:44:43
Kalau begitu, bagaimanakah saya harus menyediakannya untuk menggunakan webpack-dev-server secara terus