03. folder-structure.md【create-react-app】


id: folder-structure
title: Folder Structure


After creation, your project should look like this:

应用创建后,项目结构类似:

my-app/
  README.md
  node_modules/
  package.json
  public/
    index.html
    favicon.ico
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

For the project to build, these files must exist with exact filenames:

项目中一些文件是必须的,并且文件名也不可以更改

  • public/index.html is the page template;
  • public/index.html 是页面的HTML模板;
  • src/index.js is the JavaScript entry point.
  • src/index.js 是应用的入口。

You can delete or rename the other files.

其他的文件都是可以删除或重命名的。

You may create subdirectories inside src. For faster rebuilds, only files inside src are processed by Webpack. You need to put any JS and CSS files inside src, otherwise Webpack won’t see them.

可以在 src 下创建子目录;为了加快应用构建、打包速度,Webpack只会处理 src 目录下的文件;任何需要被处理的文件 都必须要放在 src 目录下

Only files inside public can be used from public/index.html. Read instructions below for using assets from JavaScript and HTML.

只有 public 目录下的文件会被使用在 public/index.html 中。 起其他的如 JavaScript 和 HTML 请参考之后的说明。

You can, however, create more top-level directories. They will not be included in the production build so you can use them for things like documentation.

当然,可以在项目的根目录创建其他的文件夹,这些文件夹都不会被打包到生产环境中,因此可以用于项目文档等用途。

If you have Git installed and your project is not part of a larger repository, then a new repository will be initialized resulting in an additional top-level .git directory.

如果是使用 Git 做项目的版本控制,项目根目录还会包含 .git 顶级目录。

你可能感兴趣的:(03. folder-structure.md【create-react-app】)