1.0.11 • Published 3 years ago

ts-require v1.0.11

Weekly downloads
30
License
MIT
Repository
github
Last release
3 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

3 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago