Fork me on GitHub

React基础一

项目创建
1
2
3
4
npm install -g create-react-app       /* 安装create-react-app,建议使用cnpm */
create-react-app myapp /* 使用命令创建应用,myapp为项目名称 */
cd myapp /* 进入目录,然后启动 */
npm start
项目结构

生成项目后,脚手架为了“优雅”… …隐藏了所有的webpack相关的配置文件,此时查看myapp文件夹目录,会发现找不到任何webpack配置文件。执行以下命令:

1
npm run eject

webpack3构建react工程
安装webpack
1
npm install --save-dev webpack
参考文献
I'm not rich, but still hold the dream.
显示 Gitment 评论