Example code: wxGetRemoteJS needs to turn on enhanced compilation and allow access

The core code

// Rely on eval5 import {Interpreter} from ".. /.. /utils/eval5/interpreter/main"; let res = await this.lodaJS('https://onein.7coder.top/lib/dayjs.min.js', 'dayjs') // res ... loadJS(url, type) { let obj = {} return new Promise((resolve, reject) => { wx.request({ url, Var interpreter = new interpreter (obj, {timeout: 2000, rootContext: {console: console, setTimeout: setTimeout, clearTimeout: clearTimeout, setInterval: setInterval, clearInterval: clearInterval, wx: typeof wx === "undefined" ? undefined : wx, globalContextInFunction: obj } }); Es5 interpreter. Evaluate (res.data); // Perform interpreter. resolve(obj[type]) } }) }) },Copy the code