This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function importCompat(nodeBookModuleUrl: string) { | |
try { | |
// const { default: notebook } = await import(/*webpackIgnore: true*/ nodeBookModuleUrl) | |
// 用 eval 绕过打包逻辑 | |
return await eval(`import('${nodeBookModuleUrl}')`) | |
} catch (e) { | |
// https://github.com/guybedford/es-module-shims#shim-mode-option | |
window.esmsInitOptions = { | |
shimMode: true // default false | |
} as any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function interceptFuncCall(object: any, fnName: any, fnReplace: (originalObj: any, ...originalArgs: any[]) => any) { | |
const obj = new Proxy(object, { | |
get: function(target, propKey, receiver) { | |
if (propKey === fnName) { | |
return function() { | |
return fnReplace(target, ...arguments) | |
} | |
} | |
const val = Reflect.get(target, propKey, receiver) | |
return val |
OlderNewer