1

Install THREE.js: npm install three

Configuring aurelia.json:

"dependencies": [
      {
        "name": "three",
        "path": "../node_modules/three/build",
        "main": "three.min"
      }

importing in view: import * as THREE from 'three';

Ok so this works and I am able to use three.js, however, I would also like to use some of the plugins. Specifically GPUParticleSystem. Now this plugin depends on a Global THREE object. In a first attempt I added this to aurelia.json

"dependencies": [
          {
            "name": "three",
            "path": "../node_modules/three/build",
            "main": "three.min",
             "exports": "THREE" //this should make the library a global object?
          }

But it doesn't seem to be working? I cannot see the global variable from devTools.

Ivan Bacher
  • 5,855
  • 9
  • 36
  • 56

1 Answers1

1

One possible way of solving this is to use prepend in aurelia.json:

...
"prepend": [
    "node_modules/three/build/three.min.js",
    "node_modules/three/examples/js/GPUParticleSystem.js"
 ]
...
Ivan Bacher
  • 5,855
  • 9
  • 36
  • 56