Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 4.0.25 版本项目起不来了 #9522

Closed
leshalv opened this issue Oct 13, 2022 · 37 comments · Fixed by #9549
Closed

[Bug] 4.0.25 版本项目起不来了 #9522

leshalv opened this issue Oct 13, 2022 · 37 comments · Fixed by #9549
Assignees

Comments

@leshalv
Copy link

leshalv commented Oct 13, 2022

image

@sorrycc

------ 以上是原文 受影响的比较多 @stormslowly 直接在原贴追加了 ---

碰到这样问题,以下解法,

  1. 切换 mfsu 的策略
// .umirc.ts 
mfsu: { strategy :  'normal'}
  1. 如果想继续使用 新出的 mfsu eager 模式
    有两种方式,尝试看看哪种解了你的问题
 //  .umirc.ts
antd: { import: true}

或者

// .umirc.ts 
mfsu: {
  shared: { react: { singleton: true}}
}

大家先参照这些 解法解解看,后继我会更新一篇 mfsu blog,说下到底发生了什么。

@github-actions
Copy link

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2022
@WuJiY
Copy link

WuJiY commented Oct 13, 2022

一样

@sorrycc
Copy link
Member

sorrycc commented Oct 13, 2022

给个复现?或者试下删除 node_modules/.cache 后能否生效。

@leshalv
Copy link
Author

leshalv commented Oct 13, 2022

按照这个来解决 react-多实例问题 就好了

@sorrycc sorrycc reopened this Oct 13, 2022
@sorrycc
Copy link
Member

sorrycc commented Oct 13, 2022

@leshalv 如果之前是好的,升级后挂了,那多实例的 react 应该不是预期的,需要给复现我们排查下。

@leshalv
Copy link
Author

leshalv commented Oct 13, 2022

我看新版本用了 eager 模式,我改成 normal 就好了

@ClenLu
Copy link

ClenLu commented Oct 13, 2022

同样的问题 项目起不来了

@zhaozhiqi
Copy link

zhaozhiqi commented Oct 13, 2022

按照这个来解决 react-多实例问题 就好了

我按照这个方法修复了 我是新建的项目 按照官网指南创建完 引入antd就报了这个错误 起不来 使用的是simple版本

@coderZXM
Copy link

我也出现这个问题了,删除依赖包删除再装的时候,项目启动不了

@lijiang3136146
Copy link

我也出现这个问题

@lc-999
Copy link

lc-999 commented Oct 14, 2022

这个问题怎么样了 配置了 mfsu 但是有一些警告
目前的解决方案是
mfsu: {
shared: {
react: {
singleton: true,
},
},
},

@lijiang3136146
Copy link

这个问题怎么样了 配置了 mfsu 但是有一些警告 目前的解决方案是 mfsu: { shared: { react: { singleton: true, }, }, },

配在哪里

@sorrycc
Copy link
Member

sorrycc commented Oct 14, 2022

谁能给个复现??

@amin168
Copy link

amin168 commented Oct 14, 2022

@lijiang3136146 config.ts

@CGQAQ
Copy link

CGQAQ commented Oct 14, 2022

image

image

一样,4.0.24是好的

@stormslowly
Copy link
Member

stormslowly commented Oct 14, 2022

可以先用下面的配置 试试

// .umirc.ts
mfsu: { strategy: 'normal'} 

如果能启动,那可能项目和最新的 mfsu 的方案不兼容,可以给一个复现的项目,我来排查下。

@wanglihuaya
Copy link

按照这个来解决 react-多实例问题 就好了

这个中🀄️

@lc-999
Copy link

lc-999 commented Oct 14, 2022

使用 npx create-umi@latest 选择 pro-ant 启动项目 就可复现 @sorrycc @stormslowly

@zjfresh
Copy link

zjfresh commented Oct 14, 2022

mfsu 在 monorepo 配了 monorepoRedirect 后对子包的依赖会提升到主包进行依赖检索的问题什么时候能修复呢

#9356

新建了个子包,用的是 father 编译成 bundless 包,然后再 mfsu:exclude 排除掉的方式来解决的,但是引入后就是报的 react-多实例问题

以及后面子包引入了 tsx 和 less,需要走 umi 的编译流程

然后看文档是支持直接引用子包的src目录进行编译,就直接改 package.json 中 modules 从 dist 到 src,修改后是正常的,子包的依赖在 mfsu 不会报错找不到

然后发现不支持子包的热更新,需要 monorepoRedirect,但加了就又出现 mfsu 子包依赖找不到问题

@stormslowly
Copy link
Member

monorepo with mfsu 已经排期了

@panhezeng
Copy link

Something went wrong.
Cannot read properties of null (reading 'useContext')

TypeError: Cannot read properties of null (reading 'useContext')
at Object.useContext (react.development.js:1618:1)
at Space (index.js:43:1)
at renderWithHooks (react-dom.development.js:16305:1)
at mountIndeterminateComponent (react-dom.development.js:20074:1)
at beginWork (react-dom.development.js:21587:1)
at beginWork$1 (react-dom.development.js:27426:1)
at performUnitOfWork (react-dom.development.js:26557:1)
at workLoopSync (react-dom.development.js:26466:1)
at renderRootSync (react-dom.development.js:26434:1)
at recoverFromConcurrentError (react-dom.development.js:25850:1)
at performConcurrentWorkOnRoot (react-dom.development.js:25750:1)
at workLoop (scheduler.development.js:266:1)
at flushWork (scheduler.development.js:239:1)
at performWorkUntilDeadline (scheduler.development.js:533:1)
at queue. (mf-dep____vendor.86816a03.js:518238:7)
at run (mf-dep____vendor.86816a03.js:518212:5)
at MessagePort.listener (mf-dep____vendor.86816a03.js:518223:3) {componentStack: '\n at Space (http://169.254.117.84:8000/vendors-…7.84:8000/mf-dep____vendor.86816a03.js:453230:68)'}

"@ant-design/pro-components": "^2.3.19",
"@umijs/max": "4.0.25",
"ahooks": "^3.7.1",
"antd": "^4.23.5",

@panhezeng
Copy link

设置 mfsu: { strategy: 'normal' }, 好了

还有一个问题 pro-components 问题,那边说要你们改 ant-design/pro-components#5977

@lovewinders
Copy link

@lovewinders
Copy link

lovewinders commented Oct 17, 2022

我采用config配置mfsu: { strategy: 'normal' }解决了该报错

@yl196356303
Copy link

我也跑不起来了。。。。。。。

1 similar comment
@kaoding
Copy link
Contributor

kaoding commented Oct 17, 2022

我也跑不起来了。。。。。。。

@huangguangjie
Copy link

我浪费了半天时间。原来是小版本被更新了。太坑了吧。。。默默回到旧版本里面去。

@stormslowly
Copy link
Member

我浪费了半天时间。原来是小版本被更新了。太坑了吧。。。默默回到旧版本里面去。

看下主贴的回复

@stormslowly
Copy link
Member

Something went wrong. Cannot read properties of null (reading 'useContext')

TypeError: Cannot read properties of null (reading 'useContext') at Object.useContext (react.development.js:1618:1) at Space (index.js:43:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20074:1) at beginWork (react-dom.development.js:21587:1) at beginWork$1 (react-dom.development.js:27426:1) at performUnitOfWork (react-dom.development.js:26557:1) at workLoopSync (react-dom.development.js:26466:1) at renderRootSync (react-dom.development.js:26434:1) at recoverFromConcurrentError (react-dom.development.js:25850:1) at performConcurrentWorkOnRoot (react-dom.development.js:25750:1) at workLoop (scheduler.development.js:266:1) at flushWork (scheduler.development.js:239:1) at performWorkUntilDeadline (scheduler.development.js:533:1) at queue. (mf-dep____vendor.86816a03.js:518238:7) at run (mf-dep____vendor.86816a03.js:518212:5) at MessagePort.listener (mf-dep____vendor.86816a03.js:518223:3) {componentStack: '\n at Space (http://169.254.117.84:8000/vendors-…7.84:8000/mf-dep____vendor.86816a03.js:453230:68)'}'%7D)

"@ant-design/pro-components": "^2.3.19",
"@umijs/max": "4.0.25",
"ahooks": "^3.7.1",
"antd": "^4.23.5",

try config with

// .umirc.ts
mfsu: { strategy: 'normal'}

@eruca
Copy link

eruca commented Oct 22, 2022

今天新建使用v4.0.26,还是启动不了

@eruca
Copy link

eruca commented Oct 22, 2022

还有没人发现吗,antd button primary 在新版本里显示有问题吗?我到现在都不敢从3升级到4,问题还这么多
image

@stormslowly
Copy link
Member

今天新建使用v4.0.26,还是启动不了

我本地没有复现,贴下错误信息 或者给个最小复现

@stormslowly
Copy link
Member

还有没人发现吗,antd button primary 在新版本里显示有问题吗?我到现在都不敢从3升级到4,问题还这么多 image

这个可以给个最小复现吗? 我觉得是什么其他样式覆盖了 button ,比如 tailwind css

@xingming2020
Copy link

还有没人发现吗,antd button primary 在新版本里显示有问题吗?我到现在都不敢从3升级到4,问题还这么多 image

这个可以给个最小复现吗? 我觉得是什么其他样式覆盖了 button ,比如 tailwind css

对的,我开启 tailwind 以后也出现了这个问题,关闭就好了

@fz6m
Copy link
Member

fz6m commented Oct 25, 2022

tailwind 覆盖样式的问题可以参考下这个? #9565 (comment)

@cendolkeropok
Copy link

mfsu blog

为什么你们都可以 而我会有这样的
Validate config "mfsu" failed, "strategy" is not allowed

Validate config "mfsu" failed, "shared" is not allowed

@stormslowly
Copy link
Member

版本太低了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.