1

I'm trying to override lib/web/mage/adminhtml/browser.js in my module.

here is my Company/CampaignPopup/view/frontend/requirejs-config.js

var config = {
map: {
 "*": {
 'browser':'Company_CampaignPopup/js/adminhtml/browser-custom',
 'adminhtml/browser':'Company_CampaignPopup/js/adminhtml/browser-custom',
 'mage/adminhtml/browser': 'Company_CampaignPopup/js/adminhtml/browser-custom'
 }
 }
};

I was trying all this paths.

asked Jul 7, 2017 at 10:09
1
  • Did you find any solution? Commented Jul 18, 2017 at 7:46

1 Answer 1

1

Try following code:

  1. app/code/[VendorName]/[ModuleName]/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
 \Magento\Framework\Component\ComponentRegistrar::MODULE,
 '[VendorName]_[ModuleName]',
 __DIR__
);
  1. app/code/[VendorName]/[ModuleName]/etc/module.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
 <module name="[VendorName]_[ModuleName]" setup_version="1.0.0">
 <sequence>
 <module name="Magento_Theme"/>
 </sequence>
 </module>
</config>
  1. app/code/[VendorName]/[ModuleName]/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
 <type name="Magento\Theme\Model\View\Design">
 <arguments>
 <argument name="themes" xsi:type="array">
 <item name="adminhtml" xsi:type="string">[VendorName]/[themename]</item>
 </argument>
 </arguments>
 </type>
</config>
  1. app/design/adminhtml/[VendorName]/[themename]/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
 \Magento\Framework\Component\ComponentRegistrar::THEME,
 'adminhtml/[VendorName]/[themename]',
 __DIR__
);
  1. app/design/adminhtml/[VendorName]/[themename]/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>Theme Title</title>
 <parent>Magento/backend</parent>
</theme>
  1. app/design/adminhtml/[VendorName]/[themename]/requirejs-config.js
var config = {
 map: {
 '*': {
 'mage/adminhtml/browser':'mage/adminhtml/custom-browser'
 }
 }
};
  1. app/design/adminhtml/[VendorName]/[themename]/web/mage/adminhtml/custom-browser.js
answered Dec 22, 2017 at 19:12
1
  • Doesn't look like to work on Magento 2.4.2. Got static compilation error. Commented Mar 17, 2021 at 15:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.