Closed UltiRequiem closed 3 years ago
Build will end succesfully, but if you visit the build
This isn't an error that trunk
can resolve (nor really an error to begin with). This is the browser having a restricted policy on what it type of resources it can request and from where; I'll defer specific examples to the error message that you posted.
The dist dir also doesn't work on github pages
The failure on Github pages is because you're trying to access a resource that doesn't exist. If you actually go to the js file the browser is trying to load, you'll see it's actually GitHub returning a 404. This is because GH pages are formatted as <username>.github,io/repo_name/<path>
rather than <username>.github.io/<path>
. If you try manually load the correct location, you'll see that it'll load the correct file.
For the first, there is absolutely no solution for external (read: non-inlined) wasm files other than to use a HTTP server to actually serve the content. For the second, you can just edit where the generated HTML is asking to get. Support for automatically doing this would be blocked on being able to rewrite the output directory on render, which is semi-related to #267.
So I can't deploy things that require wasm on ghpages?
You can, you just need to edit the html that trunk generates to point to the correct location.
Thanks, for those who come later, this is what I did:
I think that using the --public-url
option would work. For example, trunk build --release --public-url rust-webassembly-counter-yew
.
Steps to reproduce:
Clone and cd: https://github.com/UltiRequiem/rust-webassembly-counter-yew
Build will end succesfully, but if you visit the build:
However, if I serve the files insted with , e.g
live-server
, it works:The dist dir also doesn't work on github pages: https://ultirequiem.github.io/rust-webassembly-counter-yew/