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

Consider advising users not to use Trunk for wasm builds, or warn them about some caveats #253

Open
rparrett opened this issue Dec 12, 2023 · 0 comments
Labels
C-bug-misleading Wrong or misleading information in the book C-enhancement New content that isn't covered already P-web Platform: Web Browser S-platforms Content about developing for a specific target platform Z-medium medium task that needs moderate time investment

Comments

@rparrett
Copy link

rparrett commented Dec 12, 2023

It seems like people love using trunk, but there are a number of ways using trunk can bite you. I totally agree with the decision to not give full blown instructions for a tool that you don't use / aren't familiar with. So I'm not totally sure what the right thing to do in the cheatbook is.

I've collected what I know about trunk (I am also not a trunk user) based on trying to help bevy users use it. I'll toss that information down below.

  • Trunk's dev web server is meant for SPAs, but bevy's asset server needs the web server to serve 404s for missing assets. By default when there is a missing file, trunk just serves 200 with the contents of index.html as the response body.

    It's a bit hard to follow what has been going on with trunk with regard to this issue. There are a number of old GH issues. There was a fork trunk-ng that added a --no-spa flag. That fork was seemingly "unforked", but I don't think that the option has made it into a release yet?

  • The html file produced uses absolute paths to reference js/wasm files. This assumes the project is being placed on its own server at the web root. That might be true in a lot of cases, but it creates a great deal of confusion when deploying to itch. On itch, your project is in a subdirectory and the CDN serves missing files as 403 errors.

    I am not sure if there is a workaround for this, other than manually editing the produced html to use ./ instead of /.

  • The asset folder must be configured with copy-dir.

@inodentry inodentry added C-enhancement New content that isn't covered already C-bug-misleading Wrong or misleading information in the book S-platforms Content about developing for a specific target platform P-web Platform: Web Browser Z-medium medium task that needs moderate time investment labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug-misleading Wrong or misleading information in the book C-enhancement New content that isn't covered already P-web Platform: Web Browser S-platforms Content about developing for a specific target platform Z-medium medium task that needs moderate time investment
Projects
None yet
Development

No branches or pull requests

2 participants