From a0e16e7ea0e1bb046018a24c96e3091fb4cab402 Mon Sep 17 00:00:00 2001 From: lilei946 Date: Tue, 10 Feb 2026 10:28:14 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20global=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=8D=E8=BF=9B=E8=A1=8Cpollyfill,=E5=85=BC=E5=AE=B9quickjs?= =?UTF-8?q?=20(#150)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4c1e47db63f495366aeff5199c9414e7307a3581. --- __tests__/examples/build-backup/sample/app.js | 12 +++++++++++- packages/hap-toolkit/src/gen-webpack-conf/index.js | 3 --- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/__tests__/examples/build-backup/sample/app.js b/__tests__/examples/build-backup/sample/app.js index f350983c..7d2ad46b 100644 --- a/__tests__/examples/build-backup/sample/app.js +++ b/__tests__/examples/build-backup/sample/app.js @@ -465,7 +465,7 @@ }, "./src/regenerator.js": (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; - const injectRef = Object.getPrototypeOf(global) || global; + const injectRef = Object.getPrototypeOf(__webpack_require__.g) || __webpack_require__.g; injectRef.regeneratorRuntime = __webpack_require__("./node_modules/@babel/runtime/regenerator/index.js"); }, "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": (module, __unused_webpack_exports, __webpack_require__) => { @@ -831,6 +831,16 @@ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } + (() => { + __webpack_require__.g = function() { + if (typeof globalThis === "object") return globalThis; + try { + return this || new Function("return this")(); + } catch (e) { + if (typeof window === "object") return window; + } + }(); + })(); var __webpack_exports__ = {}; (() => { var $app_style$ = {}; diff --git a/packages/hap-toolkit/src/gen-webpack-conf/index.js b/packages/hap-toolkit/src/gen-webpack-conf/index.js index 3f59c0ec..a31aa7a0 100644 --- a/packages/hap-toolkit/src/gen-webpack-conf/index.js +++ b/packages/hap-toolkit/src/gen-webpack-conf/index.js @@ -225,9 +225,6 @@ export default async function genWebpackConf(launchOptions, mode) { }) && !isCard const webpackConf = { - node: { - global: false - }, context: cwd, mode, cache,