创建umi项目

使用umi构建react项目,先安装umi:

npm install create-umi umi -g

然后交互式创建项目:

❯ mkdir demo
❯ cd demo
❯ create-umi
? Select the boilerplate type app
? Do you want to use typescript? No
? What functionality do you want to enable? antd, dva, internationalization
   create package.json
   create src/assets/yay.jpg
   create .gitignore
   create .editorconfig
   create .env
   create .eslintrc
   create .prettierignore
   create .prettierrc
   create .umirc.js
   create mock/.gitkeep
   create src/app.js
   create src/global.css
   create src/layouts/__tests__/index.test.js
   create src/layouts/index.css
   create src/layouts/index.js
   create src/locales/en-US.js
   create src/models/.gitkeep
   create src/pages/__tests__/__mocks__/umi-plugin-locale.js
   create src/pages/__tests__/index.test.js
   create src/pages/index.css
   create src/pages/index.js
   create webpack.config.js
✨ File Generate Done

创建项目时我选择了添加antd, dva, internationalization的支持,

  • antd: ui 框架
  • dva: 数据流
  • internationalization: 国际化

接着安装项目的依赖:

yarn install

然后启动:

yarn start

通过浏览器即可访问。

posted @ 2021-02-05 13:44  oaksharks  阅读(478)  评论(0编辑  收藏  举报