Comments (1)
This was causing the following error when using the module via a script tag
Uncaught TypeError: Cannot read property 'type' of undefined
at WebGLIndexedBufferRenderer.setIndex (three.js:15321)
at WebGLRenderer.renderBufferDirect (three.js:22689)
at renderObject (three.js:23343)
at renderObjects (three.js:23313)
at WebGLRenderer.render (three.js:23120)
The reason for this is most likely due to two versions of THREE existing, as the module uses it internally but it will also be on the window
when included via a script tag.
<script src="../js/three.min.js"></script>
<script src="../js/three-proton.js"></script> <!-- three is being used here as well -->
The solution was to import three within the module from an internal compatibility module that will use window.THREE
if it exists
const isBrowser = typeof window !== 'undefined' ? true : false;
const THREE = isBrowser && window.THREE ? window.THREE : require('three');
export const {
BoxGeometry,
Euler,
Geometry,
Mesh,
MeshBasicMaterial,
MeshLambertMaterial,
OctahedronGeometry,
SphereGeometry,
Sprite,
SpriteMaterial,
Texture,
TextureLoader,
Vector3,
AdditiveBlending,
CustomBlending,
MultiplyBlending,
NoBlending,
NormalBlending,
SubtractiveBlending,
} = THREE;
The module will now always import from here internally which will ensure that it works in all of the following situations
- Both this module and
three
are included on the page via script tags - This module is imported into a transpile target environment (ie., the app is being developed with something like webpack/parcel etc.,) and bundled for production
This has been resolved by #43
from three-nebula.
Related Issues (20)
- Typescript Support? HOT 6
- Setting blending mode example HOT 1
- System is not emitting particles HOT 4
- THREE r136 - Always the first sprite is used HOT 1
- Collision with THREE objects?
- The requested module './node_modules/three-nebula/build/three-nebula.js' does not provide an export named 'Alpha' HOT 2
- Compatibility with react native ?
- Error when using module setup - why is this so hard to implement :( HOT 3
- Dependency on @babel/runtime in esm versions HOT 4
- Editor App crash with Apple Silicon HOT 1
- Future of the library HOT 3
- how to make firefies particle in json
- texture bug in ar (android) HOT 1
- double renderer on scene when use sprite renderer
- Particle rotations?
- GPURenderer particle HOT 4
- Exception when using the Body initializer
- created types for three-nebula ✨ HOT 2
- How to get list of particles of system and update its position ?
- Unable to access Docs - 404
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three-nebula.