-
Notifications
You must be signed in to change notification settings - Fork 10.4k
add Wrangler 'find_additional_modules' documentation #17524
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
add Wrangler 'find_additional_modules' documentation #17524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 3 total issue(s) found.
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 total issue(s) found.
GregBrimble
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's not strictly related to your change, but I wonder if it's worth just calling out somewhere on this page that automatic bundling is what makes TypeScript possible. It's not actually obvious when we say stuff like "TypeScript is a first-class language on Cloudflare Workers" elsewhere in the docs.
This is especially important if we're making module discovery more accessible. It should be really clear that these modules need to be given to us as ESM/CJS/Wasm/Text or Data.
irvinebroque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty @petebacondarwin for docs, few notes re: dynamic imports behavior at runtime
|
|
||
| This approach is useful for supporting lazy loading of large or dynamically imported JavaScript files: | ||
|
|
||
| - Normally, a large lazy-imported file (for example, `await import("./large-dep.mjs")`) would be bundled directly into your entrypoint, reducing the effectiveness of the lazy loading. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if you upload these as separate modules, don't we still have an issue?
Or am I misunderstanding the problem there?
cc @jasnell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is definitely still a cost, since as I understand it, we do parse all modules at start up. The main difference, unless I am mistaken is that we don't execute the code in the lazy module until it is imported.
Despite this, we found that next-on-pages start up time was improved dramatically by splitting out chunks from the main entry-point, so there is some benefit.
Also, once we update the implementation in workerd this will become significantly improved, so things can only get better if you use this approach.
Actually, I think an even better solution would be for us to be able to run non-ESM JavaScript/TypeScript additional modules through esbuild to ensure they are also in the right state for consumption by workerd. |
There's definitely some code lying around somewhere for a "process entrypoint"/"bundle no-bundle" sort of thing which could be used. Interesting idea. And I guess |
47f4dd0 to
c7a0e61
Compare
|
Thank you Pete!!! |
Summary
Adds documentation for missing Wrangler configuration
Documentation checklist