ASSET_TYPE
Diorama cannot tell what kind of asset a URL is, most often a page address given to preload, so nothing loads for it.
On this page
ASSET_TYPE: {url} has no asset type: preload takes asset URLs or a DocumentThe type of an asset comes from the type option or from the extension: .glb and .gltf are gltf, .ktx2 is ktx2, and .jpg, .jpeg, .png, .webp, .avif and .gif are texture. Any other URL has no type.
Why it happens
app.assets.preload()ordata-dio-preloadgot a URL without a known extension, most often a page address such as/work/aurora, or an image URL without an extension. A preload only warns, in development builds, once per message.app.assets.load()got such a URL without atype. Thenreadyrejects and the error is reported:no type for {url}: pass { type } (known: {types}); a page address is not an asset.typenames a type that has no loader:no loader for "{type}" (known: {types}).- The module of a lazy loader did not import, including the lazy chunk of the three.js loaders:
the loader of "{type}" did not load.
How to fix
To preload the next page, pass its parsed Document or a container element, not its address. preload then takes the images with data-dio or data-dio-key and the URLs in data-dio-preload:
import type { App } from '@dioramajs/diorama'
export function preloadPage(app: App, next: Document, url: string) { return app.assets?.preload(next, { base: url })}For an asset URL without an extension, load it with an explicit type:
import type { App } from '@dioramajs/diorama'
export function photo(app: App) { return app.assets?.load('https://images.example.com/photo?id=42', { type: 'texture', })}An own loader gets an extension through its extensions field in the loaders option of assets().