1.0.11 • Published 4 years ago

ts-require v1.0.11

Weekly downloads
30
License
MIT
Repository
github
Last release
4 years ago

ts-require

require a ts file in js file Build Status

usage

for example: we have a ts file like this

// demo.ts
export const word = 'hello world!'
export function say() {
    return word
}

in our js file we can require use resolve path

const tsRequire = require('ts-require')();

// this will generate tmp dir in your project
cosnt data = tsRequire(path.resolve(__dirname, './demo.ts'))
// then we can use this module
data.say();
data.word;// hello world

// if you want to del it you can pass delTmp true to it
const tsRequireWithDel = require('ts-require')({
    delTemp: true
})
cosnt data = tsRequire(path.resolve(__dirname, './demo.ts'))
// then we can use this module
data.say();
data.word;// hello world
1.0.11

4 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago