前言

首先为什么想到自己实现一个React脚手架呢?是因为之前刚接触create-react-app时,觉得不太灵活。虽然文件目录很清晰,但是还是觉得不如VueCLI的可以自定义配置更加灵活。当然React官方提供了可以暴露配置的命令npm run eject,说再多不如自己实现一个。

脚手架一览

自己实现一个自定义React项目脚手架「ReactCli」_自定义

文档

Project operation

Install

npm install

Start

npm run dev

Build

npm run build

Document implication

build

Webpack configuration item.

mock

Analog data.

public

Template file.

.babelrc

Babel configuration.

.gitignore

There is no need to add NPM packages.

postcss.config.js

Postcss configuration file.

src

Project home folder.

SRC folder main file

assets

Static folder.

component

Place to store components.

request

HTTP request configuration.

router

Routing configuration.

store

State management.

utils

Tool library.

view

Where the page is stored.

App.jsx

Project template.

index.js

Project entry document.

源码地址

https://github.com/maomincoding/ReactCli

结语

可以根据自己的需求自己再进行二次加工。欢迎Star!


欢迎关注我的公众号,回复关键词【电子书】,即可获取近十几本前端热门电子书。更有精品文章等着你哦。
你还可以加我微信,我拉拢了很多IT大佬,创建了一个技术交流、文章分享群,欢迎你的加入。

  • 作者:Vam的金豆之路

  • 主要领域:前端开发

  • 微信公众号:前端历劫之路

自己实现一个自定义React项目脚手架「ReactCli」_css_02