webapck配置服务和热更新

1.命令行:cnpm install webpack-dev-server --save-dev 安装服务

2.在package.json中修改命令

{

"name":"webpacktest",

"version":"1.0.0",

"description":"webpack test",

"main":"index.js",

"scripts": {

"server":"webpack-dev-server"

},

"author":"momo",

"license":"ISC",

"devDependencies": {

"webpack":"^3.8.0",

"webpack-dev-server":"^2.9.2"

}

}

3.启动服务 npm run server 效果和live-server一样,并且支持热更新,前提是webpack在3.5以上

你可能感兴趣的:(webapck配置服务和热更新)