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

Fix web builds for itch #25

Closed
NiklasEi opened this issue Apr 6, 2022 · 2 comments
Closed

Fix web builds for itch #25

NiklasEi opened this issue Apr 6, 2022 · 2 comments

Comments

@NiklasEi
Copy link
Owner

NiklasEi commented Apr 6, 2022

The .zip files currently created by trunk are not compatible with itch.io, because they load resources from non-relative paths.

@idanarye
Copy link

idanarye commented Jun 10, 2022

Note for those who want to fix it manually:

  1. Unzip the archive and edit index.html.
  2. Find these two lines:
    <link rel="preload" href="/<game-name>-<some-hash>_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
    <link rel="modulepreload" href="/<game-name>-<same-hash>.js"></head>
    And add a . before the / in the href.
  3. Go to the end of the file, to this line:
    <script type="module">import init from '/<game-name>-<same-hash>.js';init('/<game-name>-<same-hash>.wasm');</script></body></html>
    And add a . in before the / in the string in the import statement and the starting passed to the init() function.
  4. Upload the unzipped directory with the modified index.html (no need to re-zip it if you use butler)

@NiklasEi
Copy link
Owner Author

This is currently not possible with trunk (see trunk-rs/trunk#395). I will use a workaround that replaces the links in CI 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants