Open radiorz opened 1 year ago
I find absolute path is work:
const Hook = require("require-in-the-middle");
// Hook into the Test module
const hook = new Hook(["G:\\xxx\\math\\require_hack\\Test.js"], function (
exports,
name,
basedir
) {
// 在这里对Test模块进行修改或扩展
console.log("Hooked into module:", name);
// 返回你想要的修改后的exports对象
return exports;
});
const Test = require("./Test");
but it doesnt work when using null or ['./Test.js']
This pr is work for local files, but still not merged into master branch
Like I have a Test.js file, could i change it like this: