<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: chencheng</title>
    <description>The latest articles on DEV Community by chencheng (@sorrycc).</description>
    <link>https://dev.to/sorrycc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F67114%2Fece638ab-4e1c-463f-a57f-f31042aa5f60.jpeg</url>
      <title>DEV Community: chencheng</title>
      <link>https://dev.to/sorrycc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sorrycc"/>
    <language>en</language>
    <item>
      <title>Release umi 2.0 -- a pluggable enterprise-level react application framework</title>
      <dc:creator>chencheng</dc:creator>
      <pubDate>Mon, 03 Sep 2018 00:07:45 +0000</pubDate>
      <link>https://dev.to/sorrycc/release-umi-20----a-pluggable-enterprise-level-react-application-framework-2dl3</link>
      <guid>https://dev.to/sorrycc/release-umi-20----a-pluggable-enterprise-level-react-application-framework-2dl3</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgw.alipayobjects.com%2Fzos%2Frmsportal%2FCZcJsXOXCqIbglBjTrWs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgw.alipayobjects.com%2Fzos%2Frmsportal%2FCZcJsXOXCqIbglBjTrWs.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://umijs.org/" rel="noopener noreferrer"&gt;https://umijs.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It has been half a year after &lt;a href="https://github.com/sorrycc/blog/issues/64" rel="noopener noreferrer"&gt;umi 1.0 release&lt;/a&gt;. During this time, umi has done a lot of refactoring and improvement , 438 commits, 20 beta versions. And today, we are very happy to see &lt;strong&gt;it released version 2.0&lt;/strong&gt;, and repositioned as &lt;strong&gt;a pluggable enterprise-level react application framework&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is umi?
&lt;/h2&gt;

&lt;p&gt;It's based on routing, supports &lt;a href="https://umijs.org/guide/router.html" rel="noopener noreferrer"&gt;next.js-like conventional routing&lt;/a&gt;, and various advanced routing functions, such as &lt;a href="https://umijs.org/en/plugin/umi-plugin-react.html#dynamicimport" rel="noopener noreferrer"&gt;routing-level on-demand loading&lt;/a&gt;. Then with a complete &lt;a href="https://umijs.org/plugin/" rel="noopener noreferrer"&gt;plugin system&lt;/a&gt;, covering every life cycle from source code to build product, umi is able to support various functional extensions and business needs, currently umi have almost 50+ plugins in both community and inside company.&lt;/p&gt;

&lt;p&gt;umi is the basic front-end framework of &lt;a href="https://www.antfin.com/" rel="noopener noreferrer"&gt;Ant Financial&lt;/a&gt;, and has served 600+ applications directly or indirectly, including java, node, mobile app, Hybrid app, pure front-end assets app, CMS app, and more. umi has served our internal users very well and hopes that he can also serve external users well.&lt;/p&gt;

&lt;p&gt;It has following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📦 &lt;strong&gt;Out of box&lt;/strong&gt;，built-in react、react-router, etc&lt;/li&gt;
&lt;li&gt;🏈 &lt;strong&gt;Next.js like and &lt;a href="https://umijs.org/guide/router.html" rel="noopener noreferrer"&gt;full featured&lt;/a&gt; routing conventions&lt;/strong&gt;, also support configured routing&lt;/li&gt;
&lt;li&gt;🎉 &lt;strong&gt;Complete plugin system&lt;/strong&gt;, covering every lifecycle from source code to production&lt;/li&gt;
&lt;li&gt;🚀 &lt;strong&gt;High performance&lt;/strong&gt;, support PWA, route level code splitting, etc via plugin&lt;/li&gt;
&lt;li&gt;💈 &lt;strong&gt;Support static export&lt;/strong&gt;, , adapt to various environments, such as console app, mobile app, &lt;a href="https://github.com/eggjs/egg" rel="noopener noreferrer"&gt;egg&lt;/a&gt;, Alipay wallet, etc&lt;/li&gt;
&lt;li&gt;🚄 &lt;strong&gt;Fast dev startup&lt;/strong&gt;, support enable &lt;a href="https://umijs.org/plugin/umi-plugin-react.html#dll" rel="noopener noreferrer"&gt;dll&lt;/a&gt; and &lt;a href="https://umijs.org/plugin/umi-plugin-react.html#hardSource" rel="noopener noreferrer"&gt;hard-source-webpack-plugin&lt;/a&gt; with config&lt;/li&gt;
&lt;li&gt;🐠 &lt;strong&gt;Compatible IE9&lt;/strong&gt;, based on &lt;a href="https://umijs.org/plugin/umi-plugin-react.html#polyfills" rel="noopener noreferrer"&gt;umi-plugin-polyfills&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🍁 &lt;strong&gt;Support TypeScript&lt;/strong&gt;, including d.ts definition and &lt;code&gt;umi test&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;🌴 &lt;strong&gt;Deep integration with &lt;a href="https://dvajs.com/" rel="noopener noreferrer"&gt;dva&lt;/a&gt;&lt;/strong&gt;, support duck directory, automatic loading of model, code splitting, etc&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's new in 2.0?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Light core and beginner friendly
&lt;/h3&gt;

&lt;p&gt;umi@1 has many built-in optimizations, such as on-demand compilation, on-demand loading, eslint, pwa, antd, etc. These solutions can improve the development experience and production code, but also improve the cost of learning umi.&lt;/p&gt;

&lt;p&gt;So umi@2 turns off a lot of optimizations by default:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compile on demand&lt;/li&gt;
&lt;li&gt;Load on demand&lt;/li&gt;
&lt;li&gt;serviceWorker&lt;/li&gt;
&lt;li&gt;antd&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These features are then implemented by plugins, which could be turned on as needed to ensure the lightweight of the umi core. At the same time, the default build only produces index.html, umi.js, and umi.css, which is more friendly to the beginner.&lt;/p&gt;

&lt;h3&gt;
  
  
  New Plugin system
&lt;/h3&gt;

&lt;p&gt;The plugin system of umi@1 is a bit too powerful, everything can be done and modified. So umi@2 refactored the plugin mechanism, &lt;strong&gt;made a lot of constraints, clarified what can be done, what can't be done,&lt;/strong&gt; and provides a more friendly &lt;a href="https://umijs.org/plugin/develop.html" rel="noopener noreferrer"&gt;plugin API&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;At the same time, this plugin system has been verified in our company internally. The excellent internal framework Bigfish consisting of more than 30 plugins is serving Ant Financial well, including features like bacon, deploy with java/node, performance, service integrate, permissions, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  umi-plugin-react
&lt;/h3&gt;

&lt;p&gt;The plugin for umi@1 is a bit loose. It usually needs to install multiple plugins when using umi. It is troublesome to upgrade and use, so we provide umi-plugin-react. umi-plugin-react is a collection of plugins, similar to the concept of presets in babel.&lt;/p&gt;

&lt;p&gt;Currently, there are 13 plugins in umi-plugin-react, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dva integrate&lt;/li&gt;
&lt;li&gt;Antd integrate&lt;/li&gt;
&lt;li&gt;Routes modification&lt;/li&gt;
&lt;li&gt;IE(9/10/11) compatibility&lt;/li&gt;
&lt;li&gt;Convensional i18n solution&lt;/li&gt;
&lt;li&gt;Switch react to preact or other libraries&lt;/li&gt;
&lt;li&gt;Route level code-splitting, and the level could be customized&lt;/li&gt;
&lt;li&gt;Boost dev with dll&lt;/li&gt;
&lt;li&gt;Boost dev with &lt;a href="https://github.com/mzgoddard/hard-source-webpack-plugin" rel="noopener noreferrer"&gt;hard-source-webpack-plugin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Enable PWA&lt;/li&gt;
&lt;li&gt;Enable hd solution&lt;/li&gt;
&lt;li&gt;Enable fastClick&lt;/li&gt;
&lt;li&gt;Support title confiration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please checkout &lt;a href="https://umijs.org/plugin/umi-plugin-react.html" rel="noopener noreferrer"&gt;https://umijs.org/plugin/umi-plugin-react.html&lt;/a&gt; for detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://medium.com/webpack/webpack-4-released-today-6cdb994702d4" rel="noopener noreferrer"&gt;webpack@4&lt;/a&gt; + &lt;a href="https://babeljs.io/blog/2018/08/27/7.0.0" rel="noopener noreferrer"&gt;babel@7&lt;/a&gt; + ...
&lt;/h3&gt;

&lt;p&gt;We upgraded the main dependencies to the latest, such as webpack@4, babel@7, less@3, postcss@7, typescript@3, etc., as well as related build performance improvements.&lt;/p&gt;

&lt;p&gt;And, we used &lt;a href="https://github.com/mozilla-neutrino/webpack-chain" rel="noopener noreferrer"&gt;webpack-chain&lt;/a&gt; to extend the webpack configuration, which is a more stable solution than the previous &lt;code&gt;webpack.config.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;chainWebpack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;webpack&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Set alias&lt;/span&gt;
    &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path/to/a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Remove the default progress bar&lt;/span&gt;
    &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;progress&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;umi generate&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;umi@2 supports the &lt;code&gt;umi generate&lt;/code&gt;(alias of &lt;code&gt;umi g&lt;/code&gt;) command to generate files quickly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;umi g page index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And, &lt;code&gt;umi generate&lt;/code&gt; is extendable. For example, umi-plugin-dva extends the key &lt;code&gt;dva:model&lt;/code&gt;, so we could generate the model of dva with &lt;code&gt;umi g dva:model global&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Other improvements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Configuring environment variables via &lt;code&gt;.env&lt;/code&gt; and &lt;code&gt;.env.local&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Supports extending routing information of conventional routing via comments in the &lt;code&gt;yaml&lt;/code&gt; format&lt;/li&gt;
&lt;li&gt;Improved umi dev 404 page&lt;/li&gt;
&lt;li&gt;Refact &lt;code&gt;umi/dynamic&lt;/code&gt; with react-loadable&lt;/li&gt;
&lt;li&gt;Improve &lt;code&gt;umi test&lt;/code&gt;, allows you to specify test files, and pass parameters to jest-cli&lt;/li&gt;
&lt;li&gt;Improve &lt;code&gt;umi test&lt;/code&gt;, supports webpack aliases&lt;/li&gt;
&lt;li&gt;Improve &lt;code&gt;umi dev&lt;/code&gt;, supports configuring https certificates&lt;/li&gt;
&lt;li&gt;Improve &lt;code&gt;umi dev&lt;/code&gt;, do styles extract, then uses css-hot-loader for hot updates, consistent with &lt;code&gt;umi build&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Enable &lt;a href="https://github.com/umijs/es5-imcompatible-versions" rel="noopener noreferrer"&gt;es5ImcompatibleVersions&lt;/a&gt; by default&lt;/li&gt;
&lt;li&gt;Remove the large performance consumer case-sensitive-paths-webpack-plugin&lt;/li&gt;
&lt;li&gt;Add webpack alias &lt;code&gt;@&lt;/code&gt; which point to the &lt;code&gt;src&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;Use local umi to run if found&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Get start is very easy,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install deps&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;yarn global add umi &lt;span class="c"&gt;# OR npm install -g umi&lt;/span&gt;

&lt;span class="c"&gt;# Create application&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;myapp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;myapp

&lt;span class="c"&gt;# Create page&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;umi generate page index

&lt;span class="c"&gt;# Start dev server&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;umi dev

&lt;span class="c"&gt;# Build and deploy&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;umi build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checkout &lt;a href="https://umijs.org/guide/getting-started.html" rel="noopener noreferrer"&gt;https://umijs.org/guide/getting-started.html&lt;/a&gt; for more detail, or watch the &lt;a href="https://www.youtube.com/watch?v=vkAUGUlYm24" rel="noopener noreferrer"&gt;10 minutes entry umi Video version&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migrate from umi@1
&lt;/h2&gt;

&lt;p&gt;Currently, &lt;a href="https://github.com/ant-design/ant-design-pro" rel="noopener noreferrer"&gt;antd-pro&lt;/a&gt; and &lt;a href="https://github.com/zuiidea/antd-admin" rel="noopener noreferrer"&gt;antd-admin&lt;/a&gt; have been upgraded to &lt;a href="mailto:umi@2"&gt;umi@2&lt;/a&gt;. If you want to upgrade, please checkout the &lt;a href="https://umijs.org/guide/migration.html" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; or &lt;a href="https://youtu.be/1mvKzFLLBck" rel="noopener noreferrer"&gt;video&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Community
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Telegram Group
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://t.me/joinchat/G0DdHw-44FO7Izt4K1lLFQ" rel="noopener noreferrer"&gt;https://t.me/joinchat/G0DdHw-44FO7Izt4K1lLFQ&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  At last
&lt;/h2&gt;

&lt;p&gt;Thanks to all the internal and external people who participated in contributing umi and using umi in the project. umi is just getting started, I hope you can improve it together, ssee you at Github! 👋&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>framework</category>
    </item>
  </channel>
</rss>
