-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Feature] stdin/stdout #76
Comments
but with this approach you can handle only single entry point, how would you handle multiple entries? |
If you are using multiple entry points, then there is no nice way to use this approach. In this case you'd be better off using the current way to do it. This suggestion is not meant as a replacement, but rather a new feature. That is, if you don't specify file1.tsx and/or file2.tsx, esbuild tries to read stdin. |
This request makes sense to me. Note that there would also have to be a way to specify the loader for stdin, since esbuild supports multiple loaders and the correct loader is currently determined using the file extension (js/jsx/ts/tsx). |
Wouldn't the --loader flag work in this case? |
The |
I confess i haven't looked at the implementation of the loader, but I meant extend it with something like: --loader:stdin=jsx. Ideally it would be better to have something like --loader=jsx, but that might result in a more convoluted solution. |
In addition to stdin and stdout support it'd useful if esbuild were to support a way to disable verbose output and warnings as most UNIX command line utilities do.
The absence of an input file would mean implicit stdin, and the absence of specifying output would mean stdout. |
I can add a |
Sure, by convention UNIX utilities and rollup send logging and warnings to stderr and output is sent to stdout, but there is usually a way to disable diagnostic info and warnings to reduce noise when these utilities are used within other scripts. Errors would continue to be enabled in even in the presence of |
Just wanted to add that this feature would be huge for Snowpack. 2 use cases that this would solve for us:
|
Thanks for everyone's input. It's very helpful. I think I now have a good idea for what the requirements are. |
This was a little tricky to implement given certain assumptions on file-based I/O in various places. I think I got them all but please let me know if you hit any issues. I released this as a minor version instead of a patch version because the new stdout behavior is potentially a breaking change if something was relying on the old implicit file output behavior. The version with the new behavior is 0.3.0. |
🚀🚀🚀 Awesome! Thanks Evan, will try it today |
Hey there.
It seems it is impossible as of now to use something like this:
My suggestion would be to check if there is an input file, if not use stdin. Likewise, if there is no outfile use stdout. Seems like a rather trivial change, I think. Not an expert in go or anything like that.
Personally, I use quite a lot of makefiles and shell scripts and this would allow me to manipulate what is passed to esbuild without changing source files. It also makes it considerably more easy to expand with other utils. For instance, there was issue #28 to remove console.log from production builds, this would allow it, with
cat
andsed
beforeesbuild
.The text was updated successfully, but these errors were encountered: