Error when package PlayCanvas into a App

When I use Hbuilder to package a PlayCanvas project into an App, this error message will appear, and both Basis and Draco will experience errors. If I set the project to no basis or draco, it will not appear. Is there any way to resolve this error while maintaining a basis in the project?

Hi @leooooooo,

I think the issue is the Hbuilder webview doesn’t support the browser Fetch API. I’ve seen that before happening and the alternative is to use XHR requests to load the wasm files.

You could either patch the PlayCanvas wasm loader for the moment or write your own to load the wasm binaries. Try submitting an issue on the engine repo about it, thinking this should be addressed on the engine level normally.

How to use XHR requests to load the wasm files?Can you use a simple example to demonstrate? I’m not very familiar with this :disappointed_relieved:No matter if you have time to use a simple example, I am very grateful to you

Internally PlayCanavs uses fetch to load the Basis/Draco runtime:

Those calls need to be replaced by an XHR call since fetch is not supported in your webview. Patching the engine is a bit advanced in this case, try submitting an issue about it in the engine repo to start with.

1 Like

Thank you very much for your reply. This is really too difficult for me, and I have also submitted an issue.Yesterday I was also conducting some tests and found that after selecting ‘LEGACY’, the packaged app will not make any errors. Is there any difference between basis and Legacy

So legacy is an older texture compression system that uses different file formats based on the platform your app is running.

It will solve this issue given it doesn’t require a WASM runtime to be loaded. Still Basis is recommended, so I hope your issue is resolved.