In browsers you can’t use so called “bare imports”. There are two recommended workflows.
- Work with a bundler and import the final app bundle into your
index.html
. - Use CDN URLs like https://cdn.jsdelivr.net/npm/three@0.117.1/build/three.module.js
You can then write the import like so:
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.117.1/build/three.module.js';
Besides, you can only use ES6 import syntax when you enhance the script tag like so:
<script type="module">