-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
编译报错,使用core-js,解决mbox问题,遇到 头条字节的global对象和微信的global对象属性差异较大,无法使用var NativeArrayBuffer = globalThis[ARRAY_BUFFER]; #17317
Comments
This was referenced Feb 15, 2025
这个问题不用看了,被deepseek误导了,其实是MBox的使用问题,有同样问题的同学可以参考https://github.com/NervJS/taro/issues/12979, 解决 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
字节跳动小程序
小程序基础库: 3.52.0.14
使用框架: React
复现步骤
import { useLaunch, usePageNotFound } from '@tarojs/taro';
import React from 'react';
import { Provider } from 'mobx-react';
import './app.scss';
import 'core-js/stable';
import userStore from "@common/store/user";
import VConsole from 'vconsole';
let uma = {};
if (typeof PRERENDER === 'undefined') {
if (process.env.TARO_ENV === 'weapp') {
uma = require('umtrack-wx');
uma.init({
appKey: 'XXXX',
useOpenid: true,
autoGetOpenid: true,
debug: false
});
}
}
//把uma 添加到Taro,后续通过Taro.uma调用uma方法 ,es6模块导入的是模块引用,
//因此放心注入,后面页面导入Taro模块是可以获取uma的
import Taro from '@tarojs/taro';
Taro.uma = uma;
//调用事件
// Taro.uma.trackEvent('bu7y', {
// name: 'car'
// });
function App({ children }) {
const store = { user: userStore };
useLaunch((option) => {
if (process.env.TARO_ENV === "h5" && option.query.vconsole) {
const vConsole = new VConsole();
}
if (!Taro.getStorageSync("src")) {
let src = process.env.TARO_ENV === "h5" ? "wap" : "yyxcxliebian";
Taro.setStorageSync("src", src);
}
if (process.env.TARO_ENV !== "h5") {
const updateManager = Taro.getUpdateManager()
if (updateManager.onCheckForUpdate) {
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
})
updateManager.onUpdateReady(function () {
Taro.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
}
}
})
usePageNotFound((res) => {
Taro.switchTab({
url: '/pages/expo/index'
})
})
// children 是将要会渲染的页面
return (
<Provider {...store}>{children}
)
}
export default App
期望结果
var globalThis = webpack_require(/*! ../internals/global-this */ "./node_modules/core-js/internals/global-this.js");
期望 globalThis 对象内容和微信小程序保持一致
实际结果
var globalThis = webpack_require(/*! ../internals/global-this */ "./node_modules/core-js/internals/global-this.js");
globalThis对象缺少很多字段
环境信息
The text was updated successfully, but these errors were encountered: