Chrome 中禁用同源策略的自定义 React 启动脚本

Custom React start script for disabled same origin policy in Chrome

目前,我使用 npm start 启动 React 应用程序,它会触发 package.json 中的 react-scripts start 命令。

这会自动启动 Chrome 浏览器,这很棒,但我需要它在 “禁用网络安全” 模式下启动 Chrome。

这是使用以下命令完成的:

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security

我如何启用此功能以 运行 代替或标准 chrome?

我试过:

"start": "BROWSER='open -n -a /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --args --user-data-dir='/tmp/chrome_dev_test' --disable-web-security' react-scripts start",

在我的 package.json 脚本中,但似乎什么也没有发生。

在package.json

中这样做
"scripts": {
    "start": "react-scripts start",
    "start:dev": "npm run start:browser && npm run start",
    "start:browser": "open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir='/tmp/chrome_dev_test' --disable-web-security",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },