Umi: AssertionError: Invalid key dva from plugin 如何搞,有没有人遇见过.

Created on 22 Nov 2018  ·  10Comments  ·  Source: umijs/umi

image
image

不知道,怎么出错了,我那里配置错误了
我的config.js
export default {
plugins: [
// ref: https://umijs.org/plugin/umi-plugin-react.html
['umi-plugin-react', {
antd: true,
dva: {
immer: true
},
dynamicImport: true,
title: 'Antd-web',
dll: false,
routes: {
exclude: [
/model.(j|t)sx?$/,
/service.(j|t)sx?$/,
/models\//,
/components\//,
/services\//,
],
},
hardSource: false,
}]
],
sass: {
test: /.sass$/,
loaders: ["style", "css?sourceMap", "postcss", "resolve-url",
{
loader: "sass-loader",
options: {
sourceMap: true,
indentedSyntax: true
}
}]
},
// 路由配置
routes: pageRoutes,
// Theme for antd
// https://ant.design/docs/react/customize-theme-cn
theme: {
'primary-color': defaultSettings.primaryColor,
}
}

All 10 comments

楼主解决没有??我也遇到了

me too

try
npm install --save umi-plugin-react
then configure the plugin in .umirc.js

export default {
  plugins: [
    [
      'umi-plugin-react',
      {
        dva: true,
      },
    ]
  ],
};

仔细查下.umirc.js配置文件,有没有特殊符号之类的。

部分文件以.开头,vscode等编辑器可以看到但是文件系统finder等看不到,漏掉就会与这个错误啦

你用的typescript的吗,在.umirc.tsx 中将dva改为true就可以了。今天用umi也碰到了

你用的typescript的吗,在.umirc.tsx 中将dva改为true就可以了。今天用umi也碰到了

不行呀,而且这样改dva属性下面的配置怎么办?

"devDependencies": {
"umi-plugin-react": "1.8.4"
}
把版本号改为1.8.4看看
yarn add [email protected] --dev

dva2+的版本可以设置为dva:true,3+的版本不行

组件名称不要使用 app 关键字

Was this page helpful?
0 / 5 - 0 ratings