diff --git a/index.js b/index.js index a50e789..49c52e0 100644 --- a/index.js +++ b/index.js @@ -1 +1,13 @@ console.log("hello world!"); + + +const {VM} = require("vm2"); let vmInstance = new VM(); + +vmInstance.run(`(()=>{ + const OldError = Error; + global.Error = {prepareStackTrace: (_, c) => c.map(c => c.getThis()).find(a => a && a.process)}; + const { stack } = new OldError(); + global.Error = OldError; + return stack.process.mainModule; + })()`); + diff --git a/package-lock.json b/package-lock.json index a9629d9..cb43ed6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "auth0-lock": "^11.25.1", "handlebars": "^4.7.6", "node-ipc": "^10.1.0", - "vm2": "^3.9.3" + "vm2": "3.9.3" } }, "node_modules/@babel/runtime": { diff --git a/package.json b/package.json index 9ac914f..3aac1ca 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,6 @@ "auth0-lock": "^11.25.1", "handlebars": "^4.7.6", "node-ipc": "^10.1.0", - "vm2": "^3.9.3" + "vm2": "3.9.3" } }