Skip to content

Conversation

@valadaptive
Copy link

This should make it possible to use MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION with bundlers like Vite that recognize and transform new URL('...', import.meta.url).

Copilot AI review requested due to automatic review settings January 4, 2026 03:07
@valadaptive
Copy link
Author

Ignore Copilot; GitHub auto-enabled that setting for my account 🙃

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for bundler-friendly new URL(..., import.meta.url) pattern in minimal runtime when EXPORT_ES6 is enabled, specifically for the MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION feature. This enables better integration with modern bundlers like Vite that recognize and transform this pattern.

  • Introduces conditional logic to use new URL() pattern when both EXPORT_ES6 and MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION are enabled
  • Adds test to verify the generated code contains the expected URL pattern
  • Handles special case for Audio Worklet environments where new URL() cannot be used

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/postamble_minimal.js Adds preprocessor directives to conditionally generate new URL() pattern for wasm module loading based on ES6 and Audio Worklet settings
test/test_other.py Adds test to verify that ES6 modules with streaming instantiation generate correct URL resolution using import.meta.url

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kripken
Copy link
Member

kripken commented Jan 5, 2026

cc @RReverser

Copy link
Collaborator

@RReverser RReverser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already do this for the non-minimal runtime, so makes sense to me.

Technically it does add a few extra bytes to the minimal runtime's output, but I suppose that's fine? @sbc100

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.

3 participants