将Vaadin与Astro一起使用
我试图在Astro Powered应用中使用Vaadin组件。不幸的是,我遇到了这个错误。
Named export 'dedupingMixin' not found. The requested module '@polymer/polymer/lib/utils/mixin.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@polymer/polymer/lib/utils/mixin.js';
const { dedupingMixin } = pkg;
这是Stackblitz的链接; ,
但总的来说,它足以设置新的Astro App( https://docs.astro.build/en/install/auto/ )安装vaadin组件;
npm i @vaadin/button
并将其导入索引Astro;
导入'@vaadin/button'
您不必使用它,导入就足够了。我也尝试在Svelte组件中使用它,这是相同的错误。有什么想法吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些遇到此问题的人,您可以如何处理它。由于Vaadin组件是Web组件,因此它们可能不会在Astro SSR开箱即用而使用。与其使用
导入量子'@vaadin/button'
,不如在确认您在浏览器上运行后选择动态导入。要减轻未风格的内容(FOUC)的闪光,请在您的应用程序中添加以下CSS:
For those encountering this issue, here's how you can work around it. Since Vaadin components are web components, they may not function smoothly with Astro SSR out of the box. Instead of statically importing with
import '@vaadin/button'
, opt for dynamic import after confirming you're running on the browser.To mitigate the Flash of Unstyled Content (FOUC), add the following CSS to your application: