Open stevepryde opened 3 months ago
For anyone who encounters this, the workaround I used was to embed the tilesets in the tilemaps in Tiled.
There are two ways to do this:
This embeds the tileset info into the TMX file rather than just referencing a TSX file that contains the same info. The actual tile images are still separate regardless. But it just means Bevy doesn't need to load the TSX file separately, which is where the issue occurs.
It's related to the fact that the Tiled hook for fetching the TSX file is sync while the Bevy way to fetch asset data is async. So it needs to call an async method from a sync method, and currently it does this by using futures_lite
. That works on most platforms but not WASM.
Here is the issue in rs-tiled for async loading, which when closed should make closing this issue trivial: https://github.com/mapeditor/rs-tiled/issues/304
Hi,
I believe I am having the same problem. When I used this plugin, and attempt to serve my project with Trunk the wasm seems to fail and I get:
Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. bevy_game-39230fd36e2500b.js:1:30
After searching around I found your (@stevepryde) post here and that you managed to get it working on your project dizzy-ducks, and successfully exported a working wasm build to itchio.
But when I cloned the dizzy ducks repo and tried to serve it locally using Trunk, I get the same issue:
Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. dizzy-ducklings-46bff8eb8e30afb.js:1:30
Did you have the same issue, or is it a problem with my local dev environment? If so, how did you get a web build working for itchio/how did you test your web build locally?
Thank you in advance, and thank you for everything you have posted so far!
Hi,
I believe I am having the same problem. When I used this plugin, and attempt to serve my project with Trunk the wasm seems to fail and I get:
Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. bevy_game-39230fd36e2500b.js:1:30
After searching around I found your (@stevepryde) post here and that you managed to get it working on your project dizzy-ducks, and successfully exported a working wasm build to itchio.
But when I cloned the dizzy ducks repo and tried to serve it locally using Trunk, I get the same issue:
Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. dizzy-ducklings-46bff8eb8e30afb.js:1:30
Did you have the same issue, or is it a problem with my local dev environment? If so, how did you get a web build working for itchio/how did you test your web build locally?
Thank you in advance, and thank you for everything you have posted so far!
So turns the ZSTD dependency of rs-tiled, even though it was supposed to be compiled without that feature? It might be a bug with WASM bindgen or something. As a quick fix I just forked rs-tiled, removed the ZSTD dependency, then forked bevy-ecs-tiled and had it depend on that modified rs-tiled repo.
The current approach for loading TSX files relies on
futures_lite
which doesn't work in WASM builds.We need a new approach for loading these assets in WASM