Conversation
Expose promise-based script loading for hosts with asynchronous resources and a synchronous importScripts adapter for bundles with packaged chunks. Keep resource lookup host-owned and test resolution, ordering, and failure propagation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
[Commented by Copilot on behalf of @bghgary] Closing while we reconsider the API. This proposal mixes host script loading with a Web Worker-specific compatibility shim without defining how dynamic imports should work across the supported engines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Created by Copilot on behalf of @bghgary]
Context
Hosts that package JavaScript as resources need to load deferred scripts without opening an unrestricted file or network path. Some hosts can provide source synchronously; others can retrieve it only asynchronously. Chakra does not parse native
import()syntax, so a bundler must transform source-level imports for that engine.Compatibility
The optional
loadScript(name)contract accepts either immediate or asynchronously resolved source. The separateimportScriptscontract supports bundlers whose chunk-loading mode requires synchronous, already-packaged resources. Webpack's built-inimport-scriptsmode cannot awaitloadScript; an async-only host needs an asynchronous bundler chunk loader. Browser builds can retain URL-based chunk loading. Neither contract changes native ES module parsing.