【前端jquery-ui警告问题】Your store is missing a dependency for a jQueryUI widget.

2.45K 浏览M2交流区

【前端jquery-ui警告问题】Your store is missing a dependency for a jQueryUI widget.

关于控制台报以下这个警告如何解决:

Fallback to JQueryUI Compat activated. Your store is missing a dependency for a jQueryUI widget. Identifying and addressing the dependency will drastically improve the performance of your site.

原因:Magento默认加载了所有jquery ui组件,无法“按需加载”,所以导致页面加载效率变慢。在Magento2.3.3版本开始,jquery/ui组件已细分开来了,以便提高性能。那么如果你的代码模块里还是以“jquery/ui”作为依赖项的话,就会报出上面的警告。

解决办法:只需将自己代码模块里所有“jquery/ui”依赖项 更改为 “jquery-ui-modules/widget” 即可~

2