We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
微信小程序
https://github.com/skyliwq/taro-recoil-demo.git 小程序基础库: 2.21.1 使用框架: React
const userInfo = selector({ key: 'userInfo', get: ({ get }) => {
return {id:34}
}
无法打包上线
ReferenceError: Window is not defined
Taro CLI 3.4.3 environment info: System: OS: macOS 12.2.1 Shell: 3.2.57 - /bin/bash Binaries: Node: 14.16.1 - /usr/local/bin/node npm: 6.14.12 - /usr/local/bin/npm npmPackages: @tarojs/components: 3.4.3 => 3.4.3 @tarojs/mini-runner: 3.4.3 => 3.4.3 @tarojs/react: 3.4.3 => 3.4.3 @tarojs/runtime: 3.4.3 => 3.4.3 @tarojs/taro: 3.4.3 => 3.4.3 @tarojs/webpack-runner: 3.4.3 => 3.4.3 babel-preset-taro: 3.4.3 => 3.4.3 eslint-config-taro: 3.4.3 => 3.4.3 react: ^17.0.2 => 17.0.2
The text was updated successfully, but these errors were encountered:
等待热心的小伙伴解决问题中..., 有一些相关的 issues 可能帮助到你!
Thank you so much!
Sorry, something went wrong.
@skyliwq 原因是 Recoil 源码里使用了 Window,而 Taro 在小程序环境没有模拟实现它。
Window
你可以简单地配置一下 definePlugin,定义一个变量 Window 即可:
definePlugin
// config/index.js config = { defineConstants: { Window: 'function () {}' }, // ... }
我们补充一下到文档。
No branches or pull requests
相关平台
微信小程序
复现仓库
https://github.com/skyliwq/taro-recoil-demo.git
小程序基础库: 2.21.1
使用框架: React
复现步骤
const userInfo = selector({
key: 'userInfo',
get: ({ get }) => {
}
期望结果
无法打包上线
实际结果
ReferenceError: Window is not defined
环境信息
The text was updated successfully, but these errors were encountered: