Skip to content

fix: use Object.setPrototypeOf in JS bindings #2922

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CountBleck
Copy link
Member

Fixes #2659.

Changes proposed in this pull request:
⯈ Use Object.setPrototypeOf({ /* instrumented imports */ }, __moduleN) instead of Object.assign(Object.create(__moduleN), { /* instrumented imports */ })

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@CountBleck CountBleck changed the title Use Object.setPrototypeOf instead of Object.create+assign for bindings fix: use Object.setPrototypeOf instead of Object.create+assign for bindings May 25, 2025
@CountBleck CountBleck changed the title fix: use Object.setPrototypeOf instead of Object.create+assign for bindings fix: use Object.setPrototypeOf in JS bindings May 25, 2025
Apparently some bundlers use objects with read-only properties for
imported modules. This conflicts with Object.assign even though the
object being assigned to only has read-only properties on its prototype.
Regardless, if the assignment is done before the prototype is set,
everything works just fine.

Fixes AssemblyScript#2659
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.

Compiling esm esm cannot be used directly in the bundler module
1 participant