Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在aurelia cli中使用THREE.js,导出为全局_Three.js_Aurelia - Fatal编程技术网

在aurelia cli中使用THREE.js,导出为全局

在aurelia cli中使用THREE.js,导出为全局,three.js,aurelia,Three.js,Aurelia,Install THREE.js:npm Install THREE 配置aurelia.json: "dependencies": [ { "name": "three", "path": "../node_modules/three/build", "main": "three.min" } 在视图中导入:import*作为“三”中的三 好的,这样就可以了,我可以使用three.js,不过,我也想使用一些插件。特别是G

Install THREE.js:
npm Install THREE

配置
aurelia.json

"dependencies": [
      {
        "name": "three",
        "path": "../node_modules/three/build",
        "main": "three.min"
      }
在视图中导入:
import*作为“三”中的三

好的,这样就可以了,我可以使用
three.js
,不过,我也想使用一些插件。特别是
GPUParticleSystem
。现在这个插件依赖于一个全局
THREE
对象。在第一次尝试中,我将其添加到
aurelia.json

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

但它似乎不起作用?我无法从devTools中看到全局变量。

解决此问题的一种可能方法是在
aurelia.json中使用
prepend

...
"prepend": [
    "node_modules/three/build/three.min.js",
    "node_modules/three/examples/js/GPUParticleSystem.js"
 ]
...