-
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
Import all files in folder #722
Comments
I would make a plugin that uses |
Closing this because I believe the above solution is sufficient. |
@evanw I am currently trying to write a drop-in replacement for With the onResolve Plugin hook I could create something like https://www.npmjs.com/package/import-glob fairly easily (like the wasm plugin example). What do you think is the better option? I would think the drop-in would benefit more but getting the AST from ts-morph seems like overkill. |
I think the import-glob approach would be the best for now. It already works with the existing plugin API and it seems pretty ergonomic to me. It's also likely to be maximally efficient vs. AST manipulation plugins. Doing ts-morph if Long term I could imagine allowing |
I ended up writing this plugin: https://npmjs.com/package/esbuild-plugin-import-glob |
I have a folder containing database migrations. I would like to include all files in a directory so that I can pass them to the database migration executor. As I understand something like
require.context
from webpack is not supported or desired in esbuild. What would your suggestion be on how I could import all files in a folder?The text was updated successfully, but these errors were encountered: