You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm bundling a containerized app that wraps parse server and the vendor code includes conditional dynamic imports that don't trigger until a certain endpoint is hit.
Despite every permutation of external configs and module formats, targets etc I've tried, I can't seem to get esbuild to emit these transitive dependencies in the bundle, or to the out folder with the bundle— the only reliable way to be able to resolve them at runtime seems to be manually copying dependencies from node_modules to the out folder in the Dockerfile. I can either do all of node_modules, which inflates my container size, or enumerate the dependencies, which adds a maintenance burden and is fragile.
I can't help but think there must be some config option or plugin I'm missing which makes this easier, but most of the discussion around dealing with dynamic imports in esbuild I can find seems to be geared toward direct deps called from app code and not transitive deps called from libraries.
Thanks for your time and thanks for the awesome tool!
The text was updated successfully, but these errors were encountered:
This is because the dynamic import code you mentioned is not analyzable. So esbuild won't know some random strings are actually pointing to modules inside node_modules and bundle them in.
The only reliable way to be able to resolve them at runtime seems to be manually copying dependencies from node_modules to the out folder in the Dockerfile...
I think this is the proper way to load these dependencies for a Node.js application. However the work can be done more cleanly with the help of npm, which I explained before in another issue.
The main idea is using npm install --omit=dev to only install non-dev dependencies in the server (or in the docker container) to ensure only minimal needed modules are downloaded.
Uh oh!
There was an error while loading. Please reload this page.
I'm bundling a containerized app that wraps parse server and the vendor code includes conditional dynamic imports that don't trigger until a certain endpoint is hit.
Despite every permutation of
external
configs and module formats, targets etc I've tried, I can't seem to get esbuild to emit these transitive dependencies in the bundle, or to the out folder with the bundle— the only reliable way to be able to resolve them at runtime seems to be manually copying dependencies from node_modules to the out folder in the Dockerfile. I can either do all of node_modules, which inflates my container size, or enumerate the dependencies, which adds a maintenance burden and is fragile.I can't help but think there must be some config option or plugin I'm missing which makes this easier, but most of the discussion around dealing with dynamic imports in esbuild I can find seems to be geared toward direct deps called from app code and not transitive deps called from libraries.
Thanks for your time and thanks for the awesome tool!
The text was updated successfully, but these errors were encountered: