Three.js - Webpack 5 and FBXLoader inline

Viewed 372

I'm using Webpack 5 and I'm trying to give a file path directly to my FBXLoader by using the new Webpack asset modules:

const loader = new FBXLoader()
loader.load('../assets/models/myModel.fbx', (object) => { ... }) // error 404 not found

But the file is always 404 not found. I managed to import the file and load it but when I pass the path inline as above it's not working.

My Webpack 5 config is using this rule:

// Fbx - only resolves import myFile from '../assets/models/myModel.fbx'
{
  test: /\.fbx/,
  type: 'asset/resource',
},
0 Answers
Related