详解webpack2+node+react+babel实现热加载(hmr)(2)

var path = require('path'); var express = require('express'); var app = express(); var oneYear = 60 * 1000 * 60 * 24 * 30; app.use(express.static(path.resolve(__dirname, '../public'), { maxAge: oneYear })); app.get('*', function(req, res) { res.sendFile(path.resolve(__dirname,'../index.html')); }); app.listen(3200, function(err) { if (err) { console.log(err); return; } console.log('Listening at :3200'); });

$ npm start //运行生产环境

这里是项目地址 https://github.com/leinov/react-hmr-demo

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygpzj.html