如何使用 Rollup 将外部依赖项导入到我的包中?
通过下面的示例,我想将 lit-html 包含到我的包中。
import { html, render } from 'https://cdn.skypack.dev/lit-html';
class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.render();
}
render() {
render(this.template, this.shadowRoot, { eventContext: this });
}
get template() {
return html`<h1>Hello, world</h1>`;
}
}
不确定您是否已经得到答案,但您可以尝试这个插件:https://github.com/mjackson/rollup-plugin-url-resolve