Skip to content

[Bug report]插件模式下无法使用computed #1947

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

Closed
PuiwahWai opened this issue Apr 9, 2025 · 3 comments
Closed

[Bug report]插件模式下无法使用computed #1947

PuiwahWai opened this issue Apr 9, 2025 · 3 comments
Assignees

Comments

@PuiwahWai
Copy link

PuiwahWai commented Apr 9, 2025

问题描述
mpx create mpx-project,
用该命令创建一个插件项目,在源码的list组件中使用computed,发现微信开发工具报此错误,疑似陷入死循环。
运行命令:yarn build

Image

环境信息描述

  1. 系统Windows
  2. "@mpxjs/webpack-plugin": "^2.9.0", "@mpxjs/api-proxy": "^2.9.0", "@mpxjs/core": "^2.9.0",
  3. 微信开发者工具 Stable 1.06.2401020,调试基础库 3.8.0

复现demo
mpx-plugin.zip

@forzgc
Copy link
Contributor

forzgc commented Apr 22, 2025

我也遇到过类似的问题,发现是分包全局变量污染导致的,可以试试下面链接中的方式暂时解决

#1809 (comment)

@Blackgan3
Copy link
Collaborator

这个问题时由于mpx全局global.__mpx对象在插件开发时存在两个Mpx实例相互覆盖,导致global.isRef对于computed的判断失效,setData的数据没有unRef,将整个Ref传递过去后导致的stack size exceeded问题。

目前在Mpx中我们对框架本身使用的global采取providePlugin注入mpxGlobal模块对象的形式,多个Mpx实例的mpxGlobal互不干扰来解决这个问题,目前已提pr,后续合入master发版后可升级解决 #1985

@hiyuki
Copy link
Collaborator

hiyuki commented May 23, 2025

@hiyuki hiyuki closed this as completed May 23, 2025
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

No branches or pull requests

4 participants