sohamkamani / three-object-loader

[DEPRECATED] NodeJS wrapper for Three.js' OBJLoader function
30 stars 31 forks source link

FileLoader is not a constructor #11

Open justin-hackin opened 7 years ago

justin-hackin commented 7 years ago

Your example fails in the context of vuejs in webpack using the vuejs-webpack-template. This may be because the most recent three package uses named exports i.e. normally uses import {Camera...} from 'three'

import OBJLoader from 'three-obj-loader'
// import * as THREE from 'three'
const THREE = require('three')
OBJLoader(THREE)
const objLoader = new THREE.OBJLoader()

(I tried the commented version too)

browser console

Uncaught (in promise) TypeError: THREE.FileLoader is not a constructor
    at THREE.OBJLoader.load (index.js?2bee:49)
justin-hackin commented 7 years ago

Seems to be a version sync issue, as newest version of OBJLoader doesn't use FileLoader https://github.com/mrdoob/three.js/blob/cf584a60bdfd24c42eaa81d484533364742bda44/examples/js/loaders/OBJLoader.js and newest THREE doesn't export it