1

我有一些使用 Lit-Element 的项目,直到今天一切都很好。我有通常的进口声明。 import {LitElement, html,css,} from "https://unpkg.com/lit-element@latest/lit-element.js?module"; 好吧,我也可以选择通过 npm 安装库,但我希望它保持原样。有什么建议是什么问题或如何解决?顺便说一句,浏览器中的错误:

无法为 lit-element@3.0.0-pre.3/lit-element.js 生成模块

SyntaxError:未知:当前未启用对实验性语法“nullishCoalescingOperator”的支持(14:54):

12 | * 需获得额外的知识产权授权,见 13 | * http://polymer.github.io/PATENTS.txt

14 | */var s;const i=t;((s=globalThis).litElementVersions??(s.litElementVersions=[])).push("3.0.0-pre.3");class o extends t{constructor( ){super(...arguments),this.I={host:this},this.Φo=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.I ).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const r=this.render();super.update(t),this.Φo=e(r,this.renderRoot, this.I)}connectedCallback(){super.connectedCallback(),this.Φo?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.Φo?.setConnected(!1)}render() {return r}}o.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:o}),globalThis.litElementPlatformSupport?.({LitElement:o});const l={O:(t,e,r )=>{tO(e,r)},P:t=>tP};export{o as LitElement,i as UpdatingElement,l as _Φ}; | ^ 15 | 16 |

将 @babel/plugin-proposal-nullish-coalescing-operator ( https://git.io/vb4Se ) 添加到 Babel 配置的“插件”部分以启用转换。

不明确的

4

0 回答 0