Skip to content

A library that allows you to load typescript files at runtime.

License

Notifications You must be signed in to change notification settings

Weichwarenprojekt/ts-importer

Repository files navigation


Quickstart

Ts importer is a small library that allows you to load typescript files at runtime.

Installation

npm i --save-dev @weichwarenprojekt/ts-importer

Usage

The library only offers the "loadModule" function. You can simply call it like this:

import { loadModule } from "@weichwarenprojekt/ts-importer";

loadModule("/absolute/path/to/the/module.ts");

In case you have special requirements you can also override the transpileOptions for the typescript transpiler by providing the TranspileOptions as second parameter:

import { loadModule } from "@weichwarenprojekt/ts-importer";
import { ScriptTarget } from "typescript";

loadModule("/absolute/path/to/the/module.ts", {
    compilerOptions: { target: ScriptTarget.ES2016, module: ModuleKind.CommonJS },
    fileName: "whatever",
});

About

A library that allows you to load typescript files at runtime.

Resources

License

Stars

Watchers

Forks

Packages

No packages published