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

前言

首先為什么想到自己實(shí)現(xiàn)一個(gè)React腳手架呢?是因?yàn)橹皠偨佑|create-react-app時(shí),覺(jué)得不太靈活。雖然文件目錄很清晰,但是還是覺(jué)得不如VueCLI的可以自定義配置更加靈活。當(dāng)然React官方提供了可以暴露配置的命令npm run eject,說(shuō)再多不如自己實(shí)現(xiàn)一個(gè)。

腳手架一覽




文檔

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é)語(yǔ)

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



作者:Vam的金豆之路

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

我的微信:maomin9761

微信公眾號(hào):前端歷劫之路