Basis module not found?


I’m finding that none of my basis compressed textures seem to be loading in any type of build, I tried deleting the basis folder, then re-importing it from the rendering tab. I also tried checking “preload” on the scripts inside the basis folder but I continue to get this error.

Basis module not found. Asset "Rectangle 216.png" basis texture variant will not be loaded.

Is there any way to force it to include it with build? I also didn’t see the wasm scripts for basis in the network tab of the web inspector.


1 Like

That’s weird. Are you able to share the project or add yaustar to it for me to take a look?

1 Like

Hey @yaustar

I believe my team is in discussion about giving access, but I’m not sure the status of that. That being said I’d like to give more info on the issue from my side.

One thing I noticed is that whenever I clear cache and refresh in my test window, is when I seem to get the issue. (then my ui elements are completely white because nothing loaded). But on 2nd refresh after the cache clear, I’ve noticed that it resolves itself, and the affected textures load as expected. Obviously this is still an issue as every user would encounter it on their first open of the app.

I’ve tried also forking the project and deleting everything but the basis folder and one of the affected textures. But now I don’t see the issue occurring anymore. I’m not sure how it fixed itself but I figured maybe forking the project fixed some pathing or re-initialized the files (or similar), but after doing this with our main project and testing immediately after, without deleting anything, I still encounter the issue. first load basis doesn’t load, second load everything loads.

Let me know if that gives any insight into the issue. Thanks.

I’ve spoken with someone from your company and there’s a MNDA in progress from our side.

I can’t really think of anything offhand and we’ve not had this issue being reported before.

It sounds like a race condition but again, difficult to really diagnose without a repro. Are there any other libraries used that could be an issue?

I assume it’s a branding issue that prevents it from being shared? Does the issue still occur if all the branded content is replaced with placeholders (eg from

Side note: There is a engine release due next week that does some basis refactoring: Basis worker fixes by slimbuck · Pull Request #3277 · playcanvas/engine · GitHub

This PR could help with the issue and will be able to check once I have a repro/access to the project.

1 Like

I am also getting this issue.

The project where I’m testing this is sadly also not a project I am able to share publically.
But I’ve made sure to set preload to true for all three basis related scripts.
I can see basis.js and basis.wasm.js getting loaded in the network tab, this is however done after a couple of textures has already been loaded.

I don’t know if this is what is causing the problem.
Because even after I see that the basis scripts have been loaded in the network tab, the error stil persists claiming that basis module has not been found.

I’m using the engine 1.46.5 version.

*Edit: I upgraded to 1.53.4 but it made no difference

I bit difficult without seeing the project. Could you fork it and strip it all out apart from the basis modules and a single basis texture? That will help a lot.

Otherwise, the setup that we recommend be used is to have basis.js, basis.wasm.js and basis.wasm.wasm to not preload.

It shouldn’t make a different but have seen cause issues under some conditions.

How the basis module works is that the first basis texture asset that is loaded, it will async download the basis module and them transcodes the texture.

The other issue I’ve seen is that some people accidentally change the name of the WASM module in basis.wasm.wasm

It should look like the following:

Looks like all you have to do is this:

      glueUrl: "/playcanvas/files/assets/110526081/1/basis.wasm.js",
      wasmUrl: "/playcanvas/files/assets/110526079/1/basis.wasm.wasm",
      fallbackUrl: "/playcanvas/files/assets/110526080/1/basis.js",

Sometime before creating your pc.Application instance. And change the url to wherever you have your basis files stored.

Atleast that was the issue I had with this.

You shouldn’t have to do that :thinking:

I’ve since learned that these need to be unticked

If you can repro this in a new blank project, I would like to take a look please

I tried with the scripts preloaded and not preloaded with the same results.

I actually set up a very basic create-react-app while I was testing, that simply creates a canvas and loads a basic scene with 1 basis compressed texture on it that you can use to test.

This is the repo, the canvas is initialized in src/App.tsx and the playcanvas assets are stored in public/playcanvas/

This is the scene used

Both should be public but let me know if you can’t access them.

Ah, I see what’s going on.

The issue is that much of the boilerplate and settings files are missing in your project that the engine uses to load basis.

When you download a published build, __settings__.js sets a global variable PRELOAD_MODULES

    {'moduleName' : 'BASIS', 'glueUrl' : 'files/assets/110887085/1/basis.wasm.js', 'wasmUrl' : 'files/assets/110887082/1/basis.wasm.wasm', 'fallbackUrl' : 'files/assets/110887084/1/basis.js', 'preload' : false},

And this is later used in the engine here:

What you’ve done is okay too and is considered the ‘engine only’ way of doing it.

1 Like

Ah I see, thats good to know.

Thanks for the help!

Hi @yaustar, this is happening in our project as well – I’ve read through the thread, but am a bit confused as to the recommended approach. Could you summarize what you would do to fix this?

I’ve added you to our project in case you want to take a look :slight_smile: (note that the branch to use is called master2).