-
Notifications
You must be signed in to change notification settings - Fork 7
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
Not taking input from gulp's pipes #5
Comments
The only remaining issue is with the build step, which gulp-esbuild doesn't use the gien aliases output from the pipes. Ref : ym-project/gulp-esbuild#5
Very interesting, glad that you got a working prototype, building backend applications in TypeScript with custom paths had been a nightmare for me in the past few days, with this addition my whole setup will be complete (from dev to prod)! Thanks for the work you're putting into this, esbuild is awesome and being able to leverage its power into gulp is a godsend! |
gulp-ts-alias
(nor any of typescript's paths plugins handlers)gulp-ts-alias
gulp-ts-alias
I have implemented. It should be tested before I merge this feature to master. I checked basic opportunities it's ok. |
Why did I do separate export for this? Default export uses entryPoints option. I just add files to array and esbuild bundles it himself. Therefore all these features can not be combined in one export. Or I just don't understand how to do this yet. |
I'll try it in the next few hours, in the meantime, I have looked at your piped example (nice to see that you took the tsconfig.json from my most recent project, my testing will be literally how I'll use it haha) and I had a small question In your piped example, you have a typescript file and use other plugins (such as If it works like that, awesome! I'll test it and come back with results on how it went! |
I am fine with a different export, as long as it is explicitly said somewhere in your readme that by default it does what (currently loads files from filesystem, not gulp's pipes). When I think of a gulp plugin, I imagine that by default, it takes the content from the pipes, and that is what lead to my initial confusion. About the question of building every file as a separate file, I think someone else already had this question, and there seems to be an option to bundle with stdin using a sourceFile option, I know I didn't want to bundle my app but I'll test few cases to see if that sourceFile options might work for my case without bundling. Thanks for looking into this so quickly! |
Without loader in stdin option you will get a syntax error if there are non-js syntaxis. And global loader option doesn't help to suppress this error.
You're right. But if you see on another plugin like webpack-stream, you will see what this plugin reads files from file system too (as I understand). I guess for bundlers it's ok.
Yes. Just user shouldn't have an access to several properties within the framework of the plugin. |
I updated |
Uh, interesting, I didn't specify a loader yet it still worked to transpile to js from ts, ah well, I'll keep that in mind
Not gonna lie, I'm not at all a master of gulp nor do I have a lot of experience, so while I imagined all gulp related tasks to use piping, it does make sense that some plugins go for the route of file system only (such as bundlers, has you said). I'm happy to see a working version from pipes for esbuild tho, as this means I can safely use other plugins with it!
Hehe yes, plugin safety after all, it just meant that I couldn't easily test if some
Awesome, I'll try it right away! |
Seems to be working perfectly in my use case! Thanks a lot! |
I will try to check most cases today or tomorrow. If it's ok I will merge to master (version 0.4.0). const {createGulpEsbuild} = require('gulp-esbuild')
const gulpEsbuild = createGulpEsbuild({
watch: boolean, // for watch mode
pipe: boolean, // to enable piping
... // for future features
}) |
Seems good, although if you were to simplify your usage, I'd recommend to add the ability to set esbuild's options straight from the In other words, that : const {createGulpEsbuild} = require('gulp-esbuild')
const gulpEsbuild = createGulpEsbuild({
watch: boolean, // for watch mode
pipe: boolean, // to enable piping
... // for future features
})
function build() {
return src('./src/index.js')
.pipe(gulpEsbuild({
outfile: 'outfile.js',
bundle: true,
}))
.pipe(dest('./dist'))
} could be, for example : const {createGulpEsbuild} = require('gulp-esbuild')
function build() {
return src('./src/index.js')
.pipe(createGulpEsbuild({
watch: boolean, // for watch mode
pipe: boolean, // to enable piping
buildOptions: {
outfile: 'outfile.js',
bundle: true,
},
... // for future features
})
.pipe(dest('./dist'))
} Just my two cents! You do as you wish :) |
Awesome! I even saw that you added an extra notice in the readme, which clears further confusions :) I'll consider this issue fixed then, thanks for the support! 🎉 |
hey the example link is offline :/. and the linked-to example on the release page doesn't contain pipedGulpEsbuild |
Hi @aunruh! About what link do you talk? |
This issue is old and |
gulp-ts-alias
rewrites the paths of imports to use TypeScript'spaths
configurations, and this plugins works as I can see because it does the right output when I comment out your plugin.Does your plugin uses what's in the pipeline of gulp to send it to esbuild or does it uses the source files? That might be my issue (or I might just not know gulp enough yet...)
Here's how I configured my gulp tasks (stripped down) :
Example working path rewrites (but with .ts output files)
Example where your plugins doesn't seem to use
gulp-ts-alias
's output (js outputted, but bad paths in output files)I need to use that other gulp plugin since currently,
esbuild
does not rewrite paths unless we use thebundle
property, which I do not want to use for my backend application.Any help will be appreciated! Thanks in adance!
The text was updated successfully, but these errors were encountered: