-1

I am using Threebox with Mapbox, I define threebox like so:

(window as any).tb = new Threebox(this, gl, { defaultLights: true });

but I am also importing THREE like so:

import * as THREE from 'three';

So that I can use it for things like raycasting.

I am getting this warning in my app:

"WARNING: Multiple instances of Three.js being imported."

I am wondering if there is a way to get threebox to use the same instance of THREE, or be able to use the threebox instance of THREE somehow, without importing THREE again.

1 Answer 1

1

The main file of Threebox exports THREE. (source)

It looks like you are using es imports (and letting a bundler handle the CommonJS exports), so wherever you are importing Threebox, you should be able to do the same with THREE.

import { THREE, Threebox } from 'threebox'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.