id: folder-structure
title: Folder Structure
After creation, your project should look like this:
應(yīng)用創(chuàng)建后,項(xiàng)目結(jié)構(gòu)類似:
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:
項(xiàng)目中一些文件是必須的,并且文件名也不可以更改:
-
public/index.htmlis the page template;
public/index.html是頁面的HTML模板;
-
src/index.jsis the JavaScript entry point.
src/index.js是應(yīng)用的入口。
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下創(chuàng)建子目錄;為了加快應(yīng)用構(gòu)建、打包速度,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.
當(dāng)然,可以在項(xiàng)目的根目錄創(chuàng)建其他的文件夾,這些文件夾都不會被打包到生產(chǎn)環(huán)境中,因此可以用于項(xiàng)目文檔等用途。
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 做項(xiàng)目的版本控制,項(xiàng)目根目錄還會包含
.git頂級目錄。