Skip to content

Add Custom JavaScript to Admin Theme

Using Magento 2.4. I want to add some custom JS in the admin area.

appcodeClientQuoteAdminThemeviewadminhtmlrequirejs-config.js

var config = {
    map: {
        '*': {
            adminTheme: 'ClientQuote_AdminTheme/js/client-admin'
        }
    },

    paths: {
        'custom-script': 'ClientQuote_AdminTheme/js/client-admin'
    }
};

I can see the above in the source of /static/adminhtml/Magento/backend/en_US/requirejs-config.js

appcodeClientQuoteAdminThemeviewadminhtmlwebjsclient-admin.js

define([
    'prototype'
], function () {
    'use strict';

    alert("andrew");
    console.log('andrew');

});

Nothing is output.

Looking at the other scripts in requirejs-config.js they all seem to added in different ways.