在处理 React 项目时,什么时候应该 运行 'yarn start' 命令?

When should you run the 'yarn start' command while working on a React project?

我找不到很多关于此命令的文档。

假设您正在处理另一个人的 React 应用程序,已将其解压缩到您的桌面并 运行 'yarn install' 以获取依赖项。您将要对代码进行一些添加。这是你运行'yarn start'的时候吗?

我得到了这些指示:

"Go to your terminal and navigate to the root folder of the extension. Type yarn start, this will make a build folder within the root folder. Stop that operation (on a mac it’s ctrl-c) and then build the updated version."

对我来说,这听起来有点像我应该先进行编辑,然后 运行 'yarn start'、停止操作,然后 运行 快速连续执行构建命令。然而,我的印象是 'yarn start' 是你一开始的 运行,在你开始处理 React 代码之前。

谁能帮我解决这个问题? 'yarn start' 在这个过程中的什么时候开始发挥作用?

谢谢!

这是您 package.json

中的预定义命令

它看起来像这样:

在你的package.json

{
  "scripts": {
    "start": "terminal go do something"
  }
}

据此,

Go to your terminal and navigate to the root folder of the extension. Type yarn start, this will make a build folder within the root folder. Stop that operation (on a mac it’s ctrl-c) and then build the updated version.

很明显,您的 yarn start 命令正在构建您的应用程序。

构建您的应用程序 意味着它将您的 jscssassets 文件捆绑到单个块文件中,该文件可以是 运行 生产中。

回到你的问题,什么时候 运行 yarn start

因此,每当您完成更改并准备上线时,您就可以调用此命令,它会为您提供更新的生产构建文件夹。