-
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
Unable to resolve files with CLI but works from file config #3652
Comments
It sounds like you have some issue with shell expanding rules, since shell command in npm scripts will be interpreted differently on different platforms. That is to say Maybe wrap your command like this would work: "build": "esbuild \"src/**\" --bundle ..." |
Yes, that’s correct. The way shell syntax works is that glob patterns without quotes are automatically interpreted and expanded by the shell before esbuild even sees them. So esbuild never sees
There is a difference between the import path Forgetting to include the leading So when the shell expands it, esbuild is treating it as a package path (because it didn't auto-correct the mistake of omitting the leading |
Thank you for explaining this, I learned something new. I did try this a few times with "build": "esbuild \"src/**\" --bundle --platform=node --outdir=dist --minify --log-level=debug" Now knowing this, looking at the documentation for glob pattnerns and elsewhere in the documentation I am not finding any mention of this behavior. I believe that would be extremely helpful to mention somewhere or perhaps change the sample code to use quoted paths since that will work everywhere. I wasted many many hours yesterday on this, and I knew the whole time it would be a very simple but non-obvious solution like this. |
This is behavior now documented here: https://esbuild.github.io/api/#glob-style-entry-points. In addition, the CLI-specific section at the top of https://esbuild.github.io/api/ now reminds readers to be aware of the behavior of their shell. |
I'm closing this issue as it has now been documented. |
I ran into a strange issue which at first appeared to be the same as #1101 .
I have a Node project (Express server) in a monorepo structured like this:
Locally I could build just fine with this in my
/server/package.json
No issues, but when I made a PR on github we have an action that runs the above build script, but it would fail with a bunch of errors like this
The files absolutely exist on disk and I'm not sure why this was trying to resolve them in a strange way thinking they were directories. I flailed around for a while trying to make this work, eventually I just changed it to use a file to build like this:
This file is
esbuild.prod.mjs
and then I have
And to my surprise that works! Both locally and when run from the github actions. I can't explain this, but I wanted to report it here. Please let me know if you need any other details about this.
The text was updated successfully, but these errors were encountered: