[build.zig]: a concrete approach to build for web with zig-build#5157
Merged
Conversation
ddee612 to
e778f38
Compare
Not-Nik
suggested changes
Aug 30, 2025
Contributor
Not-Nik
left a comment
There was a problem hiding this comment.
Overall, a very nice addition. It seems this will make building games for the web with Zig and raylib much more ergonomic!
e778f38 to
4715727
Compare
Contributor
Author
|
@Not-Nik Ok fixed it and did the others too |
Not-Nik
approved these changes
Aug 30, 2025
4715727 to
4e2ed7b
Compare
Owner
mjhanninen
pushed a commit
to mjhanninen/raylib
that referenced
this pull request
Sep 9, 2025
deathbeam
added a commit
to deathbeam/Raylib.NET
that referenced
this pull request
Oct 1, 2025
raysan5/raylib#5157 broke the emscripten builds Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
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.
For a long time, I didn't like how Zig builds for the web.
The main problem was that there wasn't any helper method and that the build system emsdk was cloned twice—once for the Raylib dependency and once on the user side.
With the helper methods, it will be cloned only once and use the same folder for the operation.
Here is an example of how the build step can look now on the user side:
It relies heavily on the zemscripten library, which provides a solid foundation for using emsdk on different platforms.
I would like to request that @Not-Nik and @maiconpintoabreu review it and share their thoughts, especially from Nik, since he maintains the Zig bindings. This approach also works with the Zig bindings and can be copied and pasted. I already tested it with a local raylib-zig instance, where I replaced the raylib bindings with my own, and it allowed me to remove
emsdk.zig.