-
Notifications
You must be signed in to change notification settings - Fork 3
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
Project very similar to web-bundler #6
Comments
Hi @cecton! 👋 I'm keen to combine forces. It looks like We are heavily invested in the backend + frontend use case, and specifically embedding the frontend files into the backend I think this is where our use cases are subtly different. We want to view the frontend and backend together as one deployable artifact. It looks to me like How would you propose combining effort? I think there might be a good path where we have a shared crate that both These are some of my wishlist features that it seems
Best, |
I totally agree with you on all the points. It is true that I designed Maybe there is a way to make bundling through build.rs and separate (run) works. That would actually merge the 2 projects. If not, we can do as you said with a common crate that has the base logic. |
This is totally doable for me. I already know how to achieve this using cargo-metadata.
After discussing about it with @fstephany (we're colleague) and reading your wish list, I realized that running the backend+frontend use case using the But I think you also made an important point: what if someone wants to work on the frontend alone. It would be faster if only the frontend is rebuilt. This is actually current the default behavior in Maybe a good compromise would be to drop the #[wasm-run(backend="backend-crate-name")] In this example, the command In the end I think our projects are mergeable in a single project. 🎉 If we all agree to merge, there are a few questions:
|
Hello here! 👋 It's good to see that bundling frontends is a thing 👍 I have another (!) use case for a bundler: the more general web development flow with a backend, frontend and sass. There's a sample project that illustrate what I'm trying to do. I don't know if i'm totally out of scope here but I would like to be able to start my development flow in one command that could look like:
The tool would watch each of the component (backend/frontend/sass) and rebuild the relevant part if something changes. When comes the time to build for a release, the necessary hooks would be exposed to customize the build process (eg., optimize the wasm, embed CSS into the html). That would broaden the scope of web-bundler or wasm-run of course as this would not specifically focus on the frontend. I guess I see it more as a Rust Webpack than what it currently is 😅 Am I completely out of touch or does it make sense? |
Ohhhh I just got it now. That's the thing with the 3 components you were talking about!! You just want the watch and retrigger the build separately depending on what has been touched? Ok I think it's feasible. |
Yep! That's why I think that it can be useful to have "entrypoints" and each of those entrypoint would have its own lifecycle (watch, pre-build, build, post-build). That opens the door to multiple small-ish wasm bundle to sparkle a regular page rendered by the backend. For example, in my Rails/React days, I would typically have a rails app and only have React Components in some pages where the user interaction would be too complex for a simple HTML form. I would then have a mini react app (or sometimes a small sprinkle of JS) just for that page. I could imagine the same with wasm bundles included in the relevant pages. I know that is not an ideal strategy right now because I would have separate wasm bundles loaded with a lot of similar glue code but it's a price I'm willing to pay to avoid the single page app. I can try to express this idea in a PR in wasm-run. |
Yes sorry... 😞 I should really read better. Not working properly: 🧠 The way I see it you don't even need entrypoint: we know what is the frontend crate, what is the backend crate and the CSS... we can use cargo-metadata to retrieve the list of files to watch and restart the different parts independently. |
Thank you for this context. It really helped me to get a better feel for how the two compare.
In my mental model, the backend triggers the build of the frontend with its build.rs script. I think it might be confusing to have this, and also have the frontend managing watching for changes in the backend. At least for me the circular dependency gets confusing 😅. In My current normal cargo command while I'm working on the frontend is Another thing to consider is that needing to run in a build.rs script adds some particular weirdnesses to
I also don't have strong feelings about Also, sorry to throw a spanner in the works, but for personal reasons I'm probably not going to be able to dedicate significant time to this in the next month or so. I'm happy to help with small changes, but rearchitecting things so that the two approaches work better together might be beyond what I can currently commit to. |
@JWorthe can you give me more details about this? I find it weird because |
Sure. The problem comes in that, underneath wasm-pack, eventually it's calling Cargo. For simplicity, I'm going to call the two instances x86 Cargo (which it currently running the build script as part of your backend build) and wasm Cargo (which is the inner one doing the frontend build). If you just run wasm-pack naively, then wasm Cargo will get stuck waiting for a lock on target which x86 Cargo is waiting for the build script to complete. I'm not sure exactly how the lock is implemented, but you can see it in action by running As you say, it would probably be more correct to tell wasm Cargo to use something like $OUT_DIR/target, provided by x86 Cargo. If I remember right, that resolves to something like The compromise that we went with is to create a new |
Ahhh so I assume wasm-pack runs a x86 build at some point... 🤔 interesting. Maybe using
I didn't really mean to say that but yes that's a solution. In
Not at all actually. No locking issue, no environment variable, no nothing.
I also love to embed a lot of things in my binaries. Rust-embed looks like a very interesting project as it combines the best of both world: loading during run time in debug, embedding in the binary in release. Thanks!
I don't think it's necessary to merge the 2 projects but I think we can easily if we want.
I'm personally all into sharing efforts and cross-companies collaboration. An OSS project only works if the maintainers work on it. Having more maintainers is only better for the survival of the project. On the other hand it reduces the hand we all have on it. |
I saw your twitter thread, and Merging seems like the right way to go. Even the con that maintaining compatibility between workflows seems like it's a pro in disguise: people will be able to jump between using the build script endpoint and the run endpoint without having to restructure how they are doing they SCSS or index.html files. It seems like the next step would be to create a github organization and start moving things over there. When I was chatting with @stephanbuys about it this morning, he felt that the org should have a name that's broader than the single project in case we later want to bring more crates into it. My personal leaning is towards giving the org the same name as the project for now, and then change the org name later if we discover we have something else that we want to put in it. What do you think? From our side, the people to add to the new org would be everyone in this group: https://github.com/orgs/panoptix-za/teams/oss-maintainers. That's @JWorthe, @stevedonovan, @tshepang and @stephanbuys. |
I'm super happy we agree 😁 🎉 I don't like to disagree with people but I'm afraid I disagree with @stephanbuys 😅 There is no "cost" about having many organizations if we want for different things. Look at serde-rs, they have one organization for everything related to serde and maintained by the same team. Here our main product will be this bundler/assembler thingy so I think it's fair if we dedicate the organization to this. Though I do agree with you: changing name later is not a problem at all. GitHub keep making redirects if that happens. There is a problem with the name There are alternatives:
I think I like wasm-embed the most 🤔 |
Hi @cecton, pleased to "e-meet" you, I've been very glad to see how this thread is developing. When I decided to open source the bundler project I was secretly afraid that the code would just languish and not find greater/general use. I would just like to clear something up, as I'm feeling a bit embarrassed about what's being attributed to me above. Github's automatic redirects only works for repos and it only reliably works up to the point that someone else (possibly malicious) registers the old organization's name, it's not ideal, and could create a vulnerability (docs). @JWorthe will happily testify that I often seem paranoid 😅, and to me, build tools, fall into the "abundance of caution" category. In the discussion we had internally I pointed out the If this thread's intent is to create an org similar to |
👋
That's a very good point 🤔 thanks for clearing that out!!
Yes! 😁 We need to be neutral as this won't belong to a single company anymore but to an OSS organization. |
I've discussed with the rest of my team and it is settled. Only the name of the project rename and then we can create the organization.
|
Thanks @cecton , @JWorthe and @stephanbuys for moving forward with this! Like @JWorthe, my favorite name is "wassemble" I don't see the existing https://github.com/wingo/wassemble as a problem as it seems to be a solo/side project with no visible intention of being a mainstream tool. I also like "pillowcase" because it's cute and it doesn't have any reference to wasm. Doing so does not lock the project to wasm only. |
I didn't notice that one since I only checked crates, not github. Naming is hard 😅 We could also disambiguate by spelling ours differently. |
Wait, @fstephany you're right. It's a 1 star project not updated recently. Ok let's go for wassemble. I will create the organization and invite everybody. (@JWorthe maybe it's best your invite your people yourself as you might not want everybody to be owner) |
(It is still time to change of name if anybody wants. I will start working on merging (stupidly) web-bundler to wasm-run and rename the project this weekend. So we have a good starting point and some time if we change our mind on something. |
|
I can get behind either, so going for the name that brings @tshepang joy seems good. |
But you prefer that than wassemble? |
I'll throw my vote behind |
Looks like we've got a winner with |
Hey everyone 👋 I finally managed to merge web-bundler to wasmbl. We can now move to this issue to continue the project: IMI-eRnD-Be/wasm-run#54 Please subscribe and please answer there on that issue from now on. It's a very basic merge: just a module called "bundler" and that's it. The CI is working so we can start to modify things confidently with a good basis. It took me a lot more time than I anticipated because the CI for Windows is locking during the bundler tests. I suspect this is related to wasm-pack but I don't have any evidence. Either way I suggest we just replace wasm-pack by the internals of wasm-run, then we can reactive the tests and see if they work. I made a checklist with the things I believe we need to do and the things I noticed we could improve on the API. Don't hesitate to add things to that list or open a discussion on their points. |
Hello 👋 I noticed there hasn't been much activity on wasmbl since we agreed on working together. I understand it's maybe not your preoccupation at the moment. So I think I will move on with the project and our collaboration. Don't hesitate to contact me if you want to retry or do something else. Best of luck to you all |
Hi, you're 100% correct, please go ahead and do what you need to do. Best of luck to you too |
Sorry about that 😅 Various life things have happened (some good, some bad) and February feels very long ago now. |
Thanks! No worry, I understand |
Hey 👋
I just found out your project today and I noticed it is very very close to what wasm-run does.
I created wasm-run because I needed a finer control on the
index.html
that is created so I can bundle the JS and the CSS together inside the index.html. I thinkweb-bundler
allows this which is great!There aren't many differences with wasm-run:
web-bundler
uses thebuild.rs
to generate the frontend files whilewasm-run
uses a cargo[bin]
that the user needs to put in their crate. Example here wherelib.rs
is meant to be the frontend compiled in wasm andmain.rs
is meant to be the bin that starts a standalone frontend.wasm-run
supports frontend-only applications and provides a small web server (tide) for that. If I'm not mistaken, I thinkweb-bundler
only supports backend+frontend scenario.web-bundler
uses wasm-pack which benefits from all the logic of wasm-pack.wasm-run
opted for wasmbindgen-cli in hope to reduce the amount of dependencies. Because of that some features are still missing inwasm-run
like the JS snippets generation. Ideally I wanted to go deeper and depends only on wasmbindgen (there isn't much to do to get the snippets working).I'm not into re-inventing the wheel and I'm all for community effort and working on common goals so I was wondering if you think we could combine our projects? Take the best ideas of both worlds and cover all the use cases. I'm not sure yet how that will translate but let me know your opinions.
(There is also the project substrate-wasm-builder that also uses the build.rs to build the WASM but it's more focused on the WASM itself.)
Best
cc @fstephany @yozhgoor
The text was updated successfully, but these errors were encountered: