写的react项目在设置了热加载后,无法在路由当中生效
//配置
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
devServer:{
contentBase: "./",
historyApiFallback: true, //不跳转
inline: true, //实时刷新
hot: true // 使用热加载插件 HotModuleReplacementPlugin
}
//展示
const app = express.Router();
app.get('/whoami', (req, res) => {
res.send("I am BatMan");
});
需要手动刷新,只有路由以下层级的组件才能热加载。