Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add support for TypeScript files #116

Open
nunoleong opened this issue May 13, 2022 · 0 comments
Open

Add support for TypeScript files #116

nunoleong opened this issue May 13, 2022 · 0 comments

Comments

@nunoleong
Copy link

Currently, Dyson only loads routes from files with extension .js.
I'd like to express my route files as .ts, in TypeScript.

However, those files are not loaded.

I've traced to loader.js:8 where it calls

const rawConfigs = requireDir(module, path.resolve(configDir));

requireDir itself accepts an optional third parameter which is an object that allows defining which extensions to look for.

Changing it to
const rawConfigs = requireDir(module, path.resolve(configDir), {extensions: ['js','ts']});

Seems to have done the trick.

Is this something that could be somehow added to Dyson?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant