Node CommonJS require enhancer, could load module from url or ts at runtime ...
[English doc] [中文文档]
- load module from url
const r = require("nedo");
const res = r(
"https://raw.githubusercontent.com/loatheb/nedo/master/__test/case/code.js"
);
console.log(res); // hello code.js
- load module from ts file
const r = require("nedo");
const res = r("./code.ts");
console.log(res); // hello code.ts
- top level await
// index.js
const r = require("nedo");
r("./code.js");
// code.js: you don't need wrap await into async a function...
await doSomeAsyncThings();
you can touch the testcase __test/index.js for much more detail.
MIT