Umi, the name is derived from the Chinese phrase “乌”. Umi is a scalable, enterprise-class Front-End Application Framework. It is based on Routing and supports both Configuration and Convention Routing to provide a complete routing functionality experience.
It is complemented by a complete Life Cycle Plug-in System, covering all use cases from source code through to build products. It supports many Function Extensions and Business Requirements.
Ant Group’s Front-End Framework Umi has served 3000+ Applications directly or indirectly, including Java, Node, H5 Wireless, Offline (Hybrid) Application, Pure Front-End Assets Application, CMS Application, etc.
Create-react-app supports build, dev, and lint. It’s a great packaging layer for Webpack. However, it doesn’t support routing, isn’t a framework, or supports configuration. So if you want to change some configurations based on this, or do technical convergence outside of the packaging layer, then you’ll run into issues.
Overall, we think next.js is an excellent option; in fact, a lot of Umi’s features were based on next.js. However, there are a few places where we think next.Js isn’t as great as Umi: for example, it’s not as well-thought-out for enterprise apps and businesses. Umi, on the other hand, has a lot of features that front-end developers will be familiar with, such as deep integration with antd/dva, as well as support for features like internationalization/permissions/data flow/configurable routing/patch schemes/external aspects of automation, etc.
First, install the node. Ensure that the version of the node you want to install is at least 10.13. (For Mac OSX, nvm can be used to manage the version of node.
$ node -v
v10.13.0
Umi strongly suggests that you use yarn to manage your npm dependencies.
# install yarn globally
$ npm i yarn -g
# confirm yarn version
$ yarn -v
Create a blank directory for your application.
$ mkdir myapp && cd myapp
Create a project using @umijs/umi-app as the template,
If using yarn,
$ yarn create @umijs/umi-app
If using npm,
$ npx @umijs/create-umi-app
For Install dependencies
$ yarn
Open http://localhost:8000/ (https://www.swhabitation.com/localhost:8000) in your browser, and you can see the following interface.
The default scaffolding includes @umijs/preset-react, which provides standard functions like layout, permissions, internationalization, dva, and simple data flow. For example, you want an ant-design-pro layout to edit.umirc.ts configuration: {}.
1
2
3
4
5
6
7
import { defineConfig } from 'umi';
export default defineConfig({
+ layout: {},
routes: [
{ path: '/', component: '@/pages/index' },
],
});
There is no need to restart yarn start; webpack will compile progressively behind the scenes, and you will see the following interface after a time.
$ yarn build
The build is generated by default in./dist. We can visualize the distribution as a tree.
tree ./dist
./dist
- index.html
- umi.css
- umi.js
Before publishing, you can test the build locally,
$ yarn global add serve
$ serve ./dist
Access http://localhost:5000 (http://localhost:5000/), and the built assets from the./dist folder will be served.
You can deploy after completing the local verification. You will need to upload the dist directory to the server.