Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to transpile TypeScript plugins directly #51

Closed
eventualbuddha opened this issue Dec 29, 2017 · 3 comments
Closed

Add option to transpile TypeScript plugins directly #51

eventualbuddha opened this issue Dec 29, 2017 · 3 comments

Comments

@eventualbuddha
Copy link
Collaborator

Probably should use ts-node the same way #31 uses babel-register, but will require some research since the options are obviously different. What should the option be called? --ts-transpile? Should we just put both --babel-transpile and this one under a single --transpile-plugins flag? Maybe it should even be on by default, as long as we’re already shipping the dependencies with the package.

cc @mcMickJuice

@mcMickJuice
Copy link
Contributor

I think the require('ts-node').register() will work just fine.

Regarding typescript transpilation by default:

  • ts-node.register requires typescript module. If it's not locally installed the command will fail. We could check for the existence of the typescript module before calling register
  • I can see the argument for loading babel-preset-env and transpiling using babel by default. There is and will be js syntax that node doesn't yet support that users might wanna utilize. Typescript is a non-standard superset of javascript so I think that users should opt in. If we require opt in, we can better message them if they don't have typescript installed locally. How would we do that if they wrote plugins in typescript but didn't have typescript installed locally? They'd get syntax errors and would blame this package 😄

Just a couple of thoughts. I can still start down the path towards implementing this and accommodate whatever you decide you'd like to do.

@mcMickJuice
Copy link
Contributor

@eventualbuddha
Copy link
Collaborator Author

Thanks! We can check that typescript is available and fail even before loading ts-node. And yeah, it should be opt-in.

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

No branches or pull requests

2 participants