关于umi的一些基本配置

    蚂蚁金服的ant design是一个很好的前端框架封装,但是在使用的过程中往往会遇到一些配置问题,比如使用ant design pro 3.0以上版本时,它采用了新的umi作为底层架构,在这里做一些它的配置简单的记录。

plugins

  • Type: Array
  • Default: []
export default {
  plugins: [
    'umi-plugin-react',
    // When the plugin has parameters, it is an array, and the second item of the array is a parameter, similar to the babel plugin.
    ['umi-plugin-react', {
      dva: true,
    }],
  ],
};

routes

  • Type: Array
  • Default: null

配置路由,如果配置了 routes,则约定式路由会不生效。

disableRedirectHoist

  • 类型:Boolean
  • 默认值:false

禁用 redirect 上提。
出于一些原因的考虑,我们在处理路由时把所有 redirect 声明提到路由最前面进行匹配,但这导致了一些问题,所以添加了这个配置项,禁用 redirect 上提。

history

  • Type: String
  • Default: browser

类型:String
默认值:browser

如需切换 history 方式为 hash(默认是 browser history),配置 history: 'hash'

outputPath

  • Type: String
  • Default: ./dist

指定输出路径。

base

  • Type: String
  • Default: /

指定 react-router 的 base,部署到非根目录时需要配置。

publicPath

  • Type: String
  • Default: /

指定 webpack 的 publicPath,指向静态资源文件所在的路径。

runtimePublicPath

  • Type: Boolean
  • Default: false

值为 true 时使用 HTML 里指定的 window.publicPath。

hash

  • Type: Boolean
  • Default: false

是否开启 hash 文件后缀。

参考链接:https://umijs.org/config/#basic

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值