-
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
entryPoints
does not support glob patterns
#381
Comments
You could always do something like this: const { build } = require("esbuild");
const glob = require("tiny-glob");
(async () => {
let entryPoints = await glob("./src/*.ts");
await build({
entryPoints,
/* ... */
});
})(); |
I know. I just thought it should either be 1) supported 2) handled (display user-friendly error) & documented. |
The reason why this looks so weird here is that Line 44 in 5e0dabf
Passing a string instead causes esbuild to iterate over the characters in the string and treat each character as an entry point path. I will add an error for this case if you pass invalid data for the |
True (oh the joys of writing plain JS files instead of TS). I actually started with an array, and the error there is at least readable :). |
This solution is far from perfect, as it doesn't require new files - that is, files created after watch has been started |
Thank you! It was also acceptable to me to use const glob = require('resolve-glob');
const options = {ignore: ["**/*.test.js", "**/*.spec.js", "**/*.stories.js"]};
const entryPoints = glob.sync(
[
"./app/javascript/**/*.ts",
"./app/javascript/**/*.tsx",
"./app/javascript/**/*.js",
"./app/javascript/**/*.jsx"
],
options)
build({
entryPoints: entryPoints,
// ...
}).catch(() => process.exit(1)) |
Do we have any solution for CLI version guys? UpdateI didn't expect solution for bash shell would be this simple esbuild $(find src/js -name *.js) --watch \
--outdir=dist --outbase=src/js --target=es6 --format=esm |
Glob patterns in
entryPoints
are not supported:throws:
When specified as an array (
entryPoints: ["./src/*.ts"]
), it throws:The text was updated successfully, but these errors were encountered: