使用yeoman 构建react项目

1.npm 全局安装

安装yo 和 generator-react-webapck
npm install -g yo
npm install -g generator-react-webpack

2.创建项目文件夹,cd到工程目录

$ yo react-webpack

根据提示即可新建一个项目

可能出现的错误

node-sass安装失败 https://github.com/luqin/blog/issues/9

常用命令

//启动开发环境服务器
$  npm start
//或者
$  npm run serve

//启动压缩版本的服务器
$  npm run serve:dist
//或者
$  npm run dist

//测试
$  npm test

//创建新的组件

$  yo react-webpack:component my/namespaced/components/name

相关文档
[yeoman官网] (http://yeoman.io )
generator-react-webpack文档
generator-react-webpack git

你可能感兴趣的:(使用yeoman 构建react项目)