【Three】threejs 导入报错:Uncaught TypeError: Failed to resolve module specifier “three“....
【代码】threejs 导入报错:Uncaught TypeError: Failed to resolve module specifier "three"....
·
您需要向浏览器提供 importmap
,在 index.html
之前添加脚本类型 importmap
importmap
<!DOCTYPE html>
<html>
<head>
<title>Discoverthreejs.com - Your First Scene</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8" />
<link
rel="icon"
href="https://discoverthreejs.com/favicon.ico"
type="image/x-icon"
/>
<link href="./styles/main.css" rel="stylesheet" type="text/css" />
<script type="importmap">
{
"imports": {
"three": "./node_modules/three/build/three.module.js"
}
}
</script>
<script type="module" src="./src/main.js"></script>
</head>
<body>
<h1>Discoverthreejs.com - Your First Scene</h1>
<div id="scene-container">
<!-- Our <canvas> will be inserted here -->
</div>
</body>
</html>
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献7条内容
所有评论(0)