gpt4 book ai didi

javascript - 使用 React 开发时窗口焦点的变化

转载 作者:行者123 更新时间:2023-11-28 03:04:21 26 4
gpt4 key购买 nike

我有一个使用 react 的设置。当我运行yarn start时,我可以开始编码,并且更改在我的浏览器中可见。问题是,每隔 10 秒左右,我的终端就会让我知道代码中的错误,并始终将焦点更改回错误所在的特定文件中的编辑器。这太烦人和令人沮丧了。我猜这与 eslint 有关。我尝试查看文档,甚至删除了 eslinrc.json 文件,但仍然坚持相同的行为。有什么办法可以阻止这种行为吗?

这是我的 package.json

{
"name": "korean-recipes",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.9.5",
"@material-ui/icons": "^4.9.1",
"@reduxjs/toolkit": "^1.2.5",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"redux": "^4.0.5"
},
"scripts": {
"lint": "yarn run start",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-react": "^7.19.0"
}
}

最佳答案

我发现了问题。这是默认由“npx create-react-app”创建的行为。要删除该行为,只需添加包含以下变量的 .env 文件:REACT_EDITOR=无

来源:https://create-react-app.dev/docs/advanced-configuration

关于javascript - 使用 React 开发时窗口焦点的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60733672/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com