@@ -3,7 +3,6 @@ import {existsSync, readFileSync} from 'fs';
3
3
import { fileURLToPath } from "url" ;
4
4
import { createRequire } from 'module' ;
5
5
import { XMLHttpRequest } from 'xmlhttprequest' ;
6
- import { simplecc } from "simplecc-wasm" ;
7
6
import path from "path" ;
8
7
import vm from 'vm' ;
9
8
import '../libs_drpy/es6-extend.js'
@@ -49,7 +48,6 @@ globalThis.Ali = Ali;
49
48
globalThis . require = createRequire ( import . meta. url ) ;
50
49
globalThis . _fetch = fetch ;
51
50
globalThis . XMLHttpRequest = XMLHttpRequest ;
52
- globalThis . simplecc = simplecc ;
53
51
globalThis . SparkAI = SparkAI ;
54
52
globalThis . pathLib = {
55
53
basename : path . basename ,
@@ -93,6 +91,7 @@ if (typeof fetchByHiker === 'undefined') { // 判断是海阔直接放弃导入p
93
91
}
94
92
}
95
93
globalThis . pupWebview = pupWebview ;
94
+
96
95
try {
97
96
if ( typeof fetchByHiker !== 'undefined' && typeof globalThis . import === 'function' ) {
98
97
await globalThis . import ( '../libs_drpy/crypto-js-wasm.js' ) ; // 海阔放在globalThis里去动态引入
@@ -113,6 +112,19 @@ try {
113
112
} ;
114
113
}
115
114
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
+
116
128
export async function getSandbox ( env = { } ) {
117
129
const { getProxyUrl} = env ;
118
130
// (可选) 加载所有 wasm 文件
0 commit comments