自己實現(xiàn)一個自定義React項目腳手架「ReactCli」

前言

首先為什么想到自己實現(xiàn)一個React腳手架呢?是因為之前剛接觸create-react-app時,覺得不太靈活。雖然文件目錄很清晰,但是還是覺得不如VueCLI的可以自定義配置更加靈活。當然React官方提供了可以暴露配置的命令npm run eject,說再多不如自己實現(xiàn)一個。

腳手架一覽




文檔

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

結(jié)語

可以根據(jù)自己的需求自己再進行二次加工。歡迎Star!



作者:Vam的金豆之路

主要領(lǐng)域:前端開發(fā)

我的微信:maomin9761

微信公眾號:前端歷劫之路