gltfjsx
gltfjsx copied to clipboard
[FEATURE] add webpack loaders support instead of manual url resolving
Now you generate this:
import React, { useRef } from 'react'
import { useGLTF } from '@react-three/drei/useGLTF'
export default function Model(props) {
const { nodes, materials } = useGLTF('/scene.gltf')
but must this:
import React, { useRef } from 'react'
import { useGLTF } from '@react-three/drei/useGLTF'
// ADD THIS
import fileUrl from './scene.gltf' // relative path to `scene.gltf` asset
export default function Model(props) {
const { nodes, materials } = useGLTF(fileUrl)
And users can add webpack loader to convert all gltf
imports to urls, and automatically compress and upload it to CDN, attach a hash to the name, add infinity caching, and whatever they want =)
Webpack will substitut all gltf
imports to CDN links, and loader just load it.
Just add --local-imports
flag for this behavior
sounds like a good idea ... i'll implement it
And users can add webpack loader to convert all gltf imports to urls, and automatically compress and upload it to CDN, attach a hash to the name, add infinity caching, and whatever they want =)
Is there any similar webpack loader already?