webpack实现修改代码实时刷新浏览器

webpack例子:https://github.com/Aquarius1993/webpackDemo

1. 需要全局和项目安装webpack和webpack-dev-server

npm install webpack webpack-dev-server -g
npm install webpack webpack-dev-server --save-dev

2. 配置webpack.config.js

// 服务器配置相关  自动刷新
    devServer: {
        historyApiFallback: true,
        hot: false,
        inline: true,
        grogress: true
    },

3. 运行项目

//调试
webpack-dev-server --inline
//打包
webpack

 

  

posted @ 2016-09-12 10:18  lhy031  阅读(5004)  评论(0编辑  收藏  举报