-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Executables without extension #116
Comments
No, it's a limitation of Node. It requires an extension to be able to run the correct extension loader. The only workaround for this may be to override |
I ran into this issue today. shebang works fine as long as the filename is in '.ts' extention, in this example, "t.ts".
But if rename "t.ts" to "t", and run "./t”, will get this error:
It looks when run without extention, the script is treated as javascript instead of typescript, no mater what can we find some way to "fake" the file extention name to node? because I would like to use typescript without extention, like this: |
Running into the same issue: I would like to drop the .ts extension from some scripts, but can't. Any usable workaround/fix known? |
@thraaawn Same as my previous comment, no. It's a limitation of |
Any idea how |
Because it registers the |
would not it be a good fit for the Not sure is it hack or not b/c i have not really got what you meant :) |
No. That means every file runs through TypeScript, even JavaScript files. If you want that, use |
Examples how to do such executables even through some tsconfig options would be much appreciated. I tried this:
#!/usr/bin/env ts-node
console.log(1 + 2);
it took quite a while before i got an error:
what am i doing wrong here? |
I'll have to play around with it later, but it looks like it is going through TypeScript as a result. As for why the file isn't found, perhaps there's an issue reading it? |
I'm going to close this. In your stack trace you can see that all files are being compiled with TypeScript (see |
I found that
ts-node
works only for files with.ts(x)
extension. And it is not possible to create binary/executable file, e.g../bin/my-ts-executable
(without extension) but with shebang#!/usr/bin/env ts-node
.It works fine with
babel-node
shebangs.Is there some limitations by TypeScript compiler or smth?
The text was updated successfully, but these errors were encountered: