-
[html,js] 외부 package import 하는 방법코딩일지/TIL 2022. 7. 1. 18:35
Install from npm (for nodejs project) [1]
npm install three
// Option 1: Import the entire three.js core library. import * as THREE from 'three'; // Option 2: Import just the parts you need. import { Scene } from 'three';
Install from CDN (for static hosting)[2]
<script type="importmap"> { "imports": { "three": "https://unpkg.com/three@<version>/build/three.module.js" } } </script>
<script type="module"> import * as THREE from 'three'; const scene = new THREE.Scene(); </script>
References
[1] Three.js installation
[2] How to dynamically import javascript with importmaps - digitalOcean.com'코딩일지 > TIL' 카테고리의 다른 글
[js, DOM] DOMRect Object (0) 2022.07.04 [js] static variables in javascript (0) 2022.07.01 [css] scroll-snap (0) 2022.07.01 [js] how to remove a dom (0) 2022.06.30 [html] Select tag (0) 2022.06.30