Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 680 Bytes

File metadata and controls

31 lines (21 loc) · 680 Bytes

NPM Version

dynamic-loader helps you run desired Typescript or Javascript after loading the specified npm packages.

  • executeJavascript
  • executeTypescript
import { executeTypescript } from "dynamic-loader"
const packageContent = fs.readFileSync("test-package-0.1.0.tgz");
executeTypescript("test-app", [
  {
    packageName: "test-package",
    packageContent: packageContent
  }
], `
      import { testOperation } from "test-package";
      testOperation().then(() => {
        console.log("completed");
      }).catch((error) => {
        console.error(error);
      });
    `);