@@ -3,7 +3,6 @@ import {existsSync, readFileSync} from 'fs';
33import { fileURLToPath } from "url" ;
44import { createRequire } from 'module' ;
55import { XMLHttpRequest } from 'xmlhttprequest' ;
6- import { simplecc } from "simplecc-wasm" ;
76import path from "path" ;
87import vm from 'vm' ;
98import '../libs_drpy/es6-extend.js'
@@ -49,7 +48,6 @@ globalThis.Ali = Ali;
4948globalThis . require = createRequire ( import . meta. url ) ;
5049globalThis . _fetch = fetch ;
5150globalThis . XMLHttpRequest = XMLHttpRequest ;
52- globalThis . simplecc = simplecc ;
5351globalThis . SparkAI = SparkAI ;
5452globalThis . pathLib = {
5553 basename : path . basename ,
@@ -93,6 +91,7 @@ if (typeof fetchByHiker === 'undefined') { // 判断是海阔直接放弃导入p
9391 }
9492}
9593globalThis . pupWebview = pupWebview ;
94+
9695try {
9796 if ( typeof fetchByHiker !== 'undefined' && typeof globalThis . import === 'function' ) {
9897 await globalThis . import ( '../libs_drpy/crypto-js-wasm.js' ) ; // 海阔放在globalThis里去动态引入
@@ -113,6 +112,19 @@ try {
113112 } ;
114113}
115114
115+ let simplecc = null ;
116+ try {
117+ // 尝试动态导入模块puppeteerHelper
118+ const simWasm = await import ( 'simplecc-wasm' ) ; // 使用动态 import
119+ simplecc = simWasm . simplecc ;
120+ console . log ( 'simplecc imported successfully' ) ;
121+ } catch ( error ) {
122+ // console.log('Failed to import puppeteerHelper:', error);
123+ console . log ( `Failed to import simplecc:${ error . message } ` ) ;
124+ }
125+ globalThis . simplecc = simplecc ;
126+
127+
116128export async function getSandbox ( env = { } ) {
117129 const { getProxyUrl} = env ;
118130 // (可选) 加载所有 wasm 文件
0 commit comments