@hology/vite-plugin
v0.0.14
Published
Vite Plugin for building Hology apps
Readme
Hology Vite Plugin
Prepares data for
Usage
Add the plugin to your vite config like below.
// vite.config.ts
import hologyBuild from '@hology/vite-plugin'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
hologyBuild()
]
})
Optional FBX to GLB conversion
FBX model assets can be converted to binary glTF during production builds. This
is disabled by default. The plugin ships FBX2glTF through its fbx2gltf
dependency, but an explicit tool path can still be provided when needed.
hologyBuild({
optimize: {
models: {
fbxToGlb: {
enabled: true,
exclude: [
'characters/problematic.fbx',
'legacy-props/*'
]
}
}
}
})To force a specific converter build, set
optimize.models.fbxToGlb.tooling.fbx2gltfPath.
Use optimize.models.fbxToGlb.exclude to leave selected FBX assets
unconverted. Exclusion entries match asset ids, asset names, fileKey, or
originalFileKey. Exact strings and simple * / ? glob patterns are
supported.
When an FBX asset has Hology's default centimeter import scale
(mesh.rescale: 0.01), the converted GLB metadata removes that rescale so the
scale correction is not applied twice. Scene objects referencing that converted
asset are also scaled up by 100 in the bundled scene blob so existing scenes
keep the same visual size. Set optimize.models.fbxToGlb.preserveFbxRescale
to keep the original rescale metadata and skip that scene-object compensation.
The conversion also preserves material assignment color keys by default. If an
FBX material slot was assigned by Hology as #e7e7e7 and FBX2glTF emits that
slot as white in the GLB, the plugin patches the GLB material base color back to
the assignment color so existing color/name based material assignments continue
to match. Set
optimize.models.fbxToGlb.preserveMaterialAssignmentColors: false to disable
this behavior.
