安装THREE.js:npm install three
配置aurelia.json
:
"dependencies": [
{
"name": "three",
"path": "../node_modules/three/build",
"main": "three.min"
}
导入视图:import * as THREE from 'three';
好的,这样可以正常工作,并且我可以使用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的全局变量。
答案 0 :(得分:1)
解决此问题的一种可能方法是在prepend
中使用aurelia.json
:
...
"prepend": [
"node_modules/three/build/three.min.js",
"node_modules/three/examples/js/GPUParticleSystem.js"
]
...