简体   繁体   English

我如何安装和使用three.js ES6模块

[英]How do I install and use three.js ES6 modules

So in all the THREE.js examples there is always stuff like所以在所有 THREE.js 示例中,总是有类似的东西

import { FirstPersonControls } from './jsm/controls/FirstPersonControls.js';

Is there a place where I can find all these libraries and their cdns?有什么地方可以找到所有这些库及其 CDN? Thanks!谢谢!

All ES6 modules files from the examples directory are part of the three npm package and can be imported like so:示例目录中的所有 ES6 模块文件都是three npm 包的一部分,可以像这样导入:

import { FirstPersonControls } from 'three/examples/jsm/controls/FirstPersonControls .js';

Various CDNs like JSDelivr or unpkg can provide these modules by URLs like: JSDelivr 或 unpkg 等各种 CDN 可以通过以下 URL 提供这些模块:

https://cdn.jsdelivr.net/npm/three@0.122/examples/jsm/controls/FirstPersonControls.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM