I just wondered whether there was any best practice for creating the webpack.config.js and package.json files when using OBJLoader (and other modules) in three.js with Webpack? If your file is bundled with .obj files, do we have to include a webpack loader for these file types?
1 Like
I just do
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
import model from './assets/model.obj'
...
const modelLoader = new OBJLoader (manager);
modelLoader.load (model, function (result) {
and it works ootb for me with default settings
1 Like
In addition to the format suggested by @makc3d, I installed url-loader with npm install
and declared the .obj and image extensions under module exports to be used with url-loader, model and texture files respectively. This will then work as expected.