使用 react-hot-service 为 Express 应用注入 React 热更新
react-hot-service 是一个 Express 中间件,它可以让您的 Express 服务器支持 React 组件的热交换,即使您的 React 代码使用了 ES6+ 语法。
如何使用
将 react-hot-service 添加到您的 Express 应用中,即可启用 react-hot-module-reloading。
import { reactHotService } from 'react-hot-service'
const loaders = {
/*...*/
}
const webpackConf = {
'context': __dirname,
'devtool': 'source-map',
// 无需手动配置 entry,它会被自动处理
output: {
filename: '[name]',
path: path(__dirname, 'src')
}
}
4.37KB
文件大小:
评论区