webpack热加载配置

const webpack = require('webapck')
const path = require('path')
const webpackDevMiddleware = require('webpack-dev-middleware')
const webpackHotMiddleware = require('webapck-hot-middleware')
const config = require('./webapck.config')
const bs = require('brower-sync').create();
config.entry.unshift('webapck-hot-middleware/client?ralode=true')
let app = new(require('express'))()

let port = 3000;
let compiler = webpack(config)

app.use(webpackDevMiddleware(conpiler,{publicPath:'/assets/'});
app.use(webpackHotMiddleware(compiler));
app.get('/',(req,res)=>res.sendFile(path.relative(__dirname,"src/index.html")))
app.listen(port)

你可能感兴趣的:(webpack)