如何在我的代码中导入 lit-html?我有这个代码:
index.js
文件夹中的文件js
:
import { html } from "lit-html";
myDiv = html`
<div>
<a href="">Hello, Click Me!</a>
</div>
`;
document.body.innerHTML += myDiv;
和index.html
文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JS Tests</title>
</head>
<body>
<script type="module" src="js/index.js"></script>
</body>
</html>
我收到这样的错误:
Uncaught TypeError: Failed to resolve module specifier "lit-html". Relative references must start with either "/", "./", or "../".