Skip to content

Override Javascript template in Custom Theme – underlying module overwrites theme template

I am trying to override the html template that is rendered using Javascript. However, it seems that the module’s html is overwriting my customization from within the theme.

E.g I want to overwrite the “breadcrumbs” template.

The base template file is in app/code/Magento/Theme/view/frontend/web/templates/breadcrumbs.html

I have copied the file to app/design/frontend/<Namespace>/<theme_name>/Magento_Theme/web/templates/breadcrumbs.html

However, even when performing a setup:static-content:deploy -f the output (pub/static/frontend/<Namespace>/<theme>/<locale>/Magento_Theme/templates/breadcrumbs.html) is the original NOT my override

Oddly if I add a random file e.g app/design/frontend/<Namespace>/<theme_name>/Magento_Theme/web/templates/random.html I see that outputted correctly to pub/static/frontend/<Namespace>/<theme>/<locale>/Magento_Theme/templates/random.html.

It seems like the Magento Theme module is taking precedence over the my custom theme.
NOTE: I have not overridden or made any modifications to requirejs-config.js

Edit: I made a picture of the various paths and what they mean for the output into pub/static where the file is referenced.

enter image description here