Reactjs 升级react脚本在运行react脚本启动时出错

Reactjs 升级react脚本在运行react脚本启动时出错,reactjs,react-scripts,Reactjs,React Scripts,将react脚本更新到版本3.4.0后,在windows中运行react脚本start时,出现以下错误: Must use import to load ES Module: C:\Users\myUser\Desktop\Projects\myproject\frontend\src\setupProxy.js require() of ES modules is not supported. require() of C:\Users\myUser\Desktop\Projects\mypr

将react脚本更新到版本
3.4.0
后,在windows中运行
react脚本start
时,出现以下错误:

Must use import to load ES Module: C:\Users\myUser\Desktop\Projects\myproject\frontend\src\setupProxy.js
require() of ES modules is not supported.
require() of C:\Users\myUser\Desktop\Projects\myproject\frontend\src\setupProxy.js from C:\Users\myUser\Desktop\Projects\myproject\frontend\node_modules\react-scripts\config\webpackDevServer.config.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename setupProxy.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\myUser\Desktop\Projects\myproject\frontend\package.json.
这是文件
setupProxy

const proxy = require('http-proxy-middleware');

module.exports = function(app) {
  const proxyTarget = process.env.REACT_APP_API || 'http://localhost:8089';
  console.log(`proxying /backend/api/* to ${proxyTarget}/backend/*`);
  app.use(proxy('/backend/api', { target: proxyTarget}));
};
为什么升级
react scripts
后会出现此错误,并且它只在windows上显示,如果在mac上运行相同的命令,则不会出现此错误。如何为windows修复此问题