在aurelia cli中使用THREE.js,导出为全局
Install 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
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"
]
...