本文介绍了如何在create-react-app中禁用热重装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在create-react-app中禁用热重载并仅手动重载浏览器?当前,它在项目中的每次更改后都会重新加载.我正在使用Firefox并尝试阻止请求 localhost:3000/sockjs-node/* 如何建议此处,但无效.

How to disable hot reload in create-react-app and reload browser only manually? Currently it reloads after every change in project.I'm using Firefox and tried to block request localhost:3000/sockjs-node/* how is suggested here but it doesn't work.

推荐答案

阻止 localhost:3000/sockjs-node/* 仅阻止对/sockjs-node/路径(注意尾随/)和所有子路径.这不会阻止对 localhost:3000/sockjs-node 的请求,这是CRA用于热重载的内容.将您的请求阻止过滤器更改为 localhost:3000/sockjs-node .

Blocking localhost:3000/sockjs-node/* only blocks requests for the /sockjs-node/ path (note the trailing /) and all subpaths. This will not block requests made to localhost:3000/sockjs-node, which is what CRA uses for hot reloading. Change your request blocking filter to localhost:3000/sockjs-node.

这篇关于如何在create-react-app中禁用热重装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 08:50