You can't use bare imports in websites. I suggest you replace the import statement with this:
import * as THREE from 'https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js';
For learning or tinkering using CDN URLs is totally fine. If you want to develop a real application, I recommend to work with a node workflow instead. Meaning you define your dependencies and project setup with npm
and use a bundler for a build. Check out the following minimal project setup example using the ES6 modules of three.js
.
https://github.com/Mugen87/three-jsm
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…