Skip to content

Add resolver-backed dynamic script loading - #259

Closed
bghgary wants to merge 1 commit into
BabylonJS:mainfrom
bghgary:bghgary-support-dynamic-imports-embedded
Closed

bghgary wants to merge 1 commit into
BabylonJS:mainfrom
bghgary:bghgary-support-dynamic-imports-embedded

Conversation

@bghgary

@bghgary bghgary commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

[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 separate importScripts contract supports bundlers whose chunk-loading mode requires synchronous, already-packaged resources. Webpack's built-in import-scripts mode cannot await loadScript; 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.

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>
@bghgary

bghgary commented Sep 29, 2026

Copy link
Copy Markdown
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.

@bghgary bghgary closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant