maxence-charriere / go-app

A package to build progressive web apps with Go programming language and WebAssembly.
https://go-app.dev
MIT License
7.97k stars 368 forks source link

WASM web application bundler like Trunk for Rust #693

Closed mar1n3r0 closed 5 months ago

mar1n3r0 commented 2 years ago

https://dev.to/pancy/build-a-decentralized-app-on-ipfs-using-webassembly-46a4

While testing this out to see how yew compares to go-app in terms of flow and binary size(10 times smaller out of the box due to lack of runtime and GC) I have noticed Rust has this trunk tool that basically does what I did manually with https://github.com/mar1n3r0/hello-ipfs

https://trunkrs.dev/#install

trunk build will produce the following HTML at dist/index.html, along with the compiled scss, WASM & the JS loader for the WASM:

<html>
  <head>
    <link rel="stylesheet" href="/index-c920ca43256fdcb9.css">
    <link rel="preload" href="/index-7eeee8fa37b7636a_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
    <link rel="modulepreload" href="/index-7eeee8fa37b7636a.js">
  </head>
  <body>
    <script type="module">
      import init from '/index-7eeee8fa37b7636a.js';
      init('/index-7eeee8fa37b7636a_bg.wasm');
    </script>
  </body>
</html>

Wouldn't it be great if we have the same portability tool for go-app?

maxence-charriere commented 5 months ago

I use to have one but it did not do much more than a makefile and too much work to maintain to fit everyone needs.