1.npm 全局安裝
安裝yo 和 generator-react-webapck
npm install -g yo
npm install -g generator-react-webpack
2.創(chuàng)建項(xiàng)目文件夾,cd到工程目錄
$ yo react-webpack
根據(jù)提示即可新建一個(gè)項(xiàng)目
可能出現(xiàn)的錯(cuò)誤
node-sass安裝失敗 https://github.com/luqin/blog/issues/9
常用命令
//啟動(dòng)開發(fā)環(huán)境服務(wù)器
$ npm start
//或者
$ npm run serve
//啟動(dòng)壓縮版本的服務(wù)器
$ npm run serve:dist
//或者
$ npm run dist
//測(cè)試
$ npm test
//創(chuàng)建新的組件
$ yo react-webpack:component my/namespaced/components/name
相關(guān)文檔
[yeoman官網(wǎng)] (http://yeoman.io )
generator-react-webpack文檔
generator-react-webpack git