Lit项目导入SockJS失败

问题描述 投票:0回答:0

我正在使用 Lit 构建一个 Web 组件,该组件利用 sockjs-client,但我在尝试导入库时遇到了问题。

当使用 import SockJS from 'sockjs-client'; 时,我收到错误消息“Uncaught SyntaxError: The requested module './../node_modules/sockjs-client/lib/entry.js' does not provide an export named '默认'。”

当尝试从'sockjs-client'导入{SockJS};时,我收到错误“Uncaught SyntaxError: The requested module './../node_modules/sockjs-client/lib/entry.js' does not provide an export named 'SockJS'。”

使用 import * as SockJS 从 'sockjs-client' 导入;导致错误“Uncaught ReferenceError: require is not defined.”

目前唯一可行的解决方案是从 CDN 导入,但我不希望依赖 CDN。谁能提供建议?

javascript sockjs lit
© www.soinside.com 2019 - 2024. All rights reserved.