根据Shopware的AI聊天答案是:
要阻止 Shopware 压缩 all.js 包中的 javascript,您可以将以下行添加到 config/packages/shopware.yaml 文件中:
shopware:
storefront:
bundle:
minify: false
我尝试按照建议更新我的 yaml 文件,但在部署过程中遇到以下错误。
Unrecognized option "storefront" under "shopware". Available options are "admin_worker", "api", "auto_update", "cache", "cart", "cdn", "dal", "deployment", "feature", "filesystem", "html_sanitizer", "increment", "logger", "media", "sales_channel_context", "sitemap", "store".
我不确定AI提供的解决方案是否正确..如果全部的话,你最终会得到unminified js
如果您想从捆绑包中排除某些 javascript,也许您需要将该特定 javascript 设置为 js 插件并动态导入它
您可以在这里找到相关内容 -> https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-javascript.html#registering-an-async-plugin