简体   繁体   中英

Magento 2 - BASE_URL not found in product details page

After upgrading the Magento version from 2.2.3 to 2.3.7.

I am facing a weird issue, On the product details page i get an error as below in the add-home-breadcrumb.js in console.

BASE_URL is not defined.

在此处输入图像描述

Can anyone help me out from this?

Investigation :

This error appears in the file

vendor/magento/module-theme/view/frontend/web/js/view/add-home-breadcrumb.js

Check screenshot below , console.log does not output anything here. 在此处输入图像描述

i tried searching for this issue as well but no success yet. One thing that i found was that is breadcrumb was not used in the previous version 2.2.3 but was included in the new version 2.3.7

the path to the file is

vendor/magento/module-theme/view/frontend/requirejs-config.js

Please check the screen shot below. the left side is the new version 2.3.7 and the right side is the previous version 2.2.3 在此处输入图像描述

BASE_URL is a constant, defined in vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml screen 1

This error can appear if your theme overrides this file, and in the overriden file, for some reason, the line with the declaration of this constant is missing. Or you are moving all script tags to the page bottom (with help of some Magento 2 module like Amasty Google Page Optimizer). In this case you need to configure this behavior the way when scripts containing baseUrl would be ignored screen 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM