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
Support dynamic lazy imports #417
Comments
Closing as a duplicate of #637, which is a superset of this really. |
Actually, it's different. That's about lazy imports ( |
Would love to have this feature. Currently, I am stuck here. I have few variable based dynamic imports that needs to run inside worker. Is there any workaround or would I have to hard code all the statically analysable dynamic imports upfront for the time being? |
One solution, we could implement, is to add a configuration option to specify additional entry-points for a Worker. These would be bundled using the same tooling as the |
Closing for now, since |
Should the docs for https://developers.cloudflare.com/workers/wrangler/commands/ |
@irvinebroque Yes, they probably should |
Cloudflare workers support imports natively, including runtime
import()
expressions.So potentially we could lazy load files by uploading such modules as "external" alongside the entry-point file.
Currently, our build process will bundle all static imports (and statically analysable dynamic imports) into the main entry-point bundle: import()-ed modules are wrapped in a function, actually executing the import() executes the inlined code.
One thing this approach doesn't currently support is imports where the module specifier is not known at build time. For example:
a.js
b.js
index.js
This issues tracks the support for being able to do this via Wrangler 2.
The text was updated successfully, but these errors were encountered: