You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopware 6.6(.0.1)主题迁移执行build-storefront时出错

解决Shopware 6.6主题迁移中JS文件未复制的问题

问题分析

错误提示的路径custom/apps/AreanetStandardTheme64/AreanetStandardtheme64/Resources/app/storefront/dist/storefront/js/areanet-standardtheme64和实际放置文件的路径不匹配,Shopware编译时找不到对应目录,导致文件无法同步到公共目录,前端加载失败。

修复步骤

1. 修正主题资源目录结构

Shopware 6.6的App类型主题,正确的JS源文件路径应为:
custom/apps/AreanetStandardTheme64/Resources/app/storefront/src/js/

  • 把JS源文件移到src/js目录下,dist目录是编译后自动生成的,无需手动创建或放置文件。

2. 调整theme.json脚本配置

修改theme.json中的script配置,指向源文件路径而非dist路径:

"script": [
    "@Storefront",
    "app/storefront/src/js/areanet-standardtheme64/areanet-standardtheme64.js"
]

3. 重新执行编译命令

运行以下命令重新编译主题:

bin/console theme:compile
bin/build-storefront.sh

4. 验证编译结果

编译完成后,Shopware会自动在Resources/app/storefront/dist下生成对应编译文件,同时同步到公共目录public/theme/<theme-id>/js/,前端即可正常加载。

额外排查点

  • 统一目录大小写:错误提示中的AreanetStandardtheme64(小写t)和主题IDAreanetStandardTheme64(大写T)不一致,需确保目录名称和主题ID完全匹配,避免大小写导致的路径识别问题。
  • 清理缓存:执行bin/console cache:clear清除Shopware缓存后,再重新编译。

内容的提问来源于stack exchange,提问作者areanet_gmbh_schmid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 19:03:12