docs($api/module-methods): add eager-weak + notes to resolveWeak#1453
docs($api/module-methods): add eager-weak + notes to resolveWeak#1453skipjack merged 4 commits intowebpack:masterfrom
Conversation
|
@faceyspacey thanks for remembering to add documentation for this new feature. Let's wait until webpack/webpack#5235 is merged and released to merge and release this. Once the main PR is merged we should probably ping a few others for review as I'm not too familiar with this topic. |
content/api/module-methods.md
Outdated
| - `"lazy"` (default): Generates a lazy-loadable chunk for each `import()`ed module. | ||
| - `"lazy-once"`: Generates a single lazy-loadable chunk that can satisfy all calls to `import()`. The chunk will be fetched on the first call to `import()`, and subsequent calls to `import()` will use the same network response. Note that this only makes sense in the case of a partially dynamic statement, e.g. ``import(`./locales/${language}.json`)``, where there are multiple module paths that could potentially be requested. | ||
| - `"eager"`: Generates no extra chunk. All modules are included in the current chunk and no additional network requests are made. A `Promise` is still returned but is already resolved. In contrast to a static import, the module isn't executed until the call to `import()` is made. | ||
| - `"eager-weak"`: Generates chunks identically to `"lazy"`, but leaves the responsibility of serving the chunks to the client up to the user. A `Promise` is still returned but, only successfully resolves if the chunks are already on the client. A network request will never be performed. This is useful for universal rendering when required chunks are always manually served in initial requests (embedded within the page), but not in cases where app navigation will trigger an import not initially served. |
There was a problem hiding this comment.
"weak": Tries to load the module if the module function has already been loaded in some other way (i. e. another chunk imported it or a script containing the module was loaded). A Promise is still returned but, only successfully resolves if the chunks are already on the client. If the module is not available, the Promise is rejected. A network request will never be performed. This is useful for universal rendering when required chunks are always manually served in initial requests (embedded within the page), but not in cases where app navigation will trigger an import not initially served.
|
@sokra's requested change has been made |
|
@faceyspacey was this released yet? No rush, but ping me when it is so we can get this in. |
|
Ok it seems the corresponding PR was merged a couple weeks ago and a few releases have been done since then. Merging... |
Docs update corresponding to:
webpack/webpack#5235