Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

v4.0.0-rc.7

Pre-release
Pre-release
Compare
Choose a tag to compare
@sorrycc sorrycc released this 17 Mar 08:40
· 539 commits to master since this release

1、更名 @umijs/pro 为 @umijs/max,命令行也由 umipro 改为 umimax

2、完善 dva 插件,默认加入 dva-loading 插件,允许通过配置加入 dva-immer 插件,

export default {
  dva: {
    immer: {
      enableES5: true,
      enableAllPlugins: true,
    }
  }
}

3、umi 的 defineConfig 接口支持类型,和 Umi 3 保持一致

import { defineConfig } from 'umi';
export default defineConfig({ history: 'hash' });

4、完善 umi g page,默认行为和 Umi 3 保持一致,同时支持通过 --dir 参数切换为目录模式,

// 正常使用
$ umi g page index
// 包含子目录
$ umi g page foo/bar
// 目录模式,等同于 umi g page foo/index
$ umi g page foo --dir

5、更多 umi g 的功能快速开启,包括 dva、jest、tailwindcss、tsconfig.json 和 prettier,执行 umi g 即可看到,

$ npx umi g
? Pick generator type › - Use arrow-keys. Return to submit.
❯   Create Pages -- Create a umi page by page name
    Enable Prettier -- Setup Prettier Configurations
    Enable Typescript -- Setup tsconfig.json
    Enable Jest -- Setup Jest Configuration
    Enable Tailwind CSS -- Setup Tailwind CSS configuration
    Enable Dva -- Configuration, Dependencies, and Model Files for Dva

6、提取 bundler 之间的公共依赖到 bundler-utils,减少重复

7、修复 locale 插件不管有没有配置 locale: {} 都会开启的问题,同时修改内核,不允许插件注册时同时拥有 default 配置和配置开启模式,比如下方的插件写法会显示报错,

api.describe({
  config: { default: { foo: 1 } },
  enableBy: api.EnableBy.config,
});

8、修复 umi config set 在没有配置文件时会报错的问题,

$ umi config set npmClient pnpm

9、修复 onRouteChange 的执行时机和参数问题,和 Umi 3 保持一致,在页面初始加载时也会触发,

export function onRouteChange({ location }) {
  console.log('current url', location.href);
}

10、路由数据层增加 absPath 信息,表示当前路由的绝对路径,node 侧的插件层可用