文件结构
创建后,你的项目应如下所示:
.
├── babel.config.js
├── commitlint.config.js
├── jest.config.js
├── jsconfig.json
├── lark.config.js
├── package.json
├── prettier.config.js
├── public
├── src
│ ├── App.tsx
│ ├── components
│ │ ├── loadable
│ │ │ ├── Loadable.tsx
│ │ │ ├── index.tsx
│ │ │ ├── loadWithInitialProps.tsx
│ │ │ └── shared.ts
│ │ ├── page-failed
│ │ │ ├── error-animation.json
│ │ │ ├── index.tsx
│ │ │ └── style.scss
│ │ └── page-loading
│ │ ├── animate.json
│ │ ├── index.tsx
│ │ └── style.scss
│ ├── constants
│ │ ├── api.ts
│ │ └── index.ts
│ ├── globals
│ │ └── history.ts
│ ├── index.html
│ ├── index.tsx
│ ├── pages
│ │ ├── index
│ │ │ ├── page.tsx
│ │ │ └── style.scss
│ │ └── playground
│ │ ├── page.tsx
│ │ └── style.scss
│ ├── routes
│ │ └── index.tsx
│ ├── style
│ │ ├── index.scss
│ │ └── typeface.scss
│ └── utils
│ └── lottie.ts
├── stylelint.config.js
├── tsconfig.json
├── types
│ ├── custom-typings.d.ts
│ └── index.d.ts
└── yarn.lock
对于要构建的项目,这些文件必须以确切的文件名存在:
src/index.html 是页面模板; src/index.tsx 是 JavaScript 入口点。
你可以删除或重命名其他文件。
你可以在 src 中创建子目录。 为了加快重新构建的速度,Webpack 默认只处理 src 中的文件。你需要将任何 JS 和 CSS 文件放在 src 中,否则 Webpack 将发现不了它们。或者可以通过修改 lark.config.js 来指定构建目录
项目创建时默认安装了 Git,包含提交前校验(lint-staged 和 husky),如果不需要可删除它