Skip to content
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

Use ES2015 for mjs build #292

Closed
wants to merge 1 commit into from
Closed

Use ES2015 for mjs build #292

wants to merge 1 commit into from

Conversation

shakiba
Copy link
Collaborator

@shakiba shakiba commented Sep 30, 2024

Since stage.js migration to ES classes, testbed mjs build is broken, this fixes the issue.

Copy link

vercel bot commented Sep 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
planck-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 30, 2024 2:53pm

@zOadT
Copy link
Collaborator

zOadT commented Sep 30, 2024

Hey! Wouldn't it potentially be too much of a breaking change to already disable the factory functions for es builds?

If I understand the problem correctly, the reason for this error is, that the stage.js code gets bundled as ES6 code (using class-syntax because it doesn't get compiled by TS) and the super() call in WorldStageNode gets down compiled to ES5 syntax (therefore trying to call the Stage.Node constructor without new keyword.
Are you sure this problem only concerns .mjs files? I would expect this to apply to all testbed builds, but maybe I understand the problem wrong here.

Couldn't we also let the stage-js code get compiled to ES5 (either using the typescript plugin or babel)? I think I would prefer this at least for now as it would not change the behavior otherwise. To test it I also tried to move WorldStageNode into a separate JS file (so it does not get compiled to ES5) and I think it also worked (though I would much prefer to compile the stage-js code)

@shakiba
Copy link
Collaborator Author

shakiba commented Sep 30, 2024

Alright, let's postpone until another major update; I updated stage.js build to es5 for now.

@shakiba shakiba closed this Sep 30, 2024
@shakiba shakiba deleted the shakiba/fix-mjs-build branch October 10, 2024 18:20
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.

2 participants