当我尝试将 Spline 3D 模型导入到我的 Web 中时,出现此错误:“index.html:1 Uncaught TypeError: 无法解析模块说明符“@splinetool/runtime”。相对引用必须以“”开头/”、“./”或“../”。“
我的 HTML:
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="css/styles.css">
<title>Vastro - The number one space trips company</title>
</head>
<body>
<header>
<div class="container-fluid home" id="home">
<div class="row align-items-center home">
<div class="col-6 ps-5 text-center text-white">
<h1>WELCOME TO <span class="vastro">VASTRO</span></h1>
</div>
<div class="col-6">
<canvas id="canvas3d"></canvas>
</div>
</div>
</div>
</header>
<script type="module" src="js/spaceship.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>
还有我的js:
import { Application } from '@splinetool/runtime';
const canvas = document.getElementById('canvas3d');
const app = new Application(canvas);
app.load('https://prod.spline.design/LwlsBLuKMVE3xr16/scene.splinecode');
我之前已经使用 npm install @splinetool/runtime 安装了依赖项。知道会发生什么吗?
我尝试删除所有项目并在其他目录中再次执行此操作并使用不同的工具(http服务器和开放实时服务器)托管
兄弟我也有同样的问题你解决了吗?