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

Taro 微信小程序下报错 #1814

Open
boringplay opened this issue Nov 3, 2024 · 5 comments
Open

Taro 微信小程序下报错 #1814

boringplay opened this issue Nov 3, 2024 · 5 comments

Comments

@boringplay
Copy link

由于 Taro 注入了 window,导致 f2 engine 在 isBrowser 上判断不出来,导致微信小程序下会报错

// packages/g-lite/src/utils/canvas.ts
export const isBrowser =
  typeof window !== 'undefined' && typeof window.document !== 'undefined';

Taro 下 window 和 document 都是有值的

@wang1212
Copy link
Member

wang1212 commented Nov 4, 2024

使用的是什么版本?

@boringplay
Copy link
Author

@antv/[email protected]

@boringplay
Copy link
Author

可以直接看 packages/g-lite/src/utils/canvas.ts 这个文件

@hustcc
Copy link
Member

hustcc commented Nov 26, 2024

直接来提个 pr 不?正好你那有环境测试。

@wang1212
Copy link
Member

可以直接看 packages/g-lite/src/utils/canvas.ts 这个文件

可以尝试将 node_modules 中 isBrowser 的逻辑修改为你预期的判断逻辑,然后在你的项目环境中验证一下,如果没问题可以提个 PR,或者反馈一下

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

3 participants