Magento 2 – Overriding Admin Theme Not Working in Production Mode with CDN [SOLVED]

admincdndeployjavascriptmagento2

Magento 2: How to enable newly created admin theme & override module?

After achieving this I have a new issue now.

I'm using CDN & in Production Mode. In the Developer mode, it works fine.

I have below configuration in Admin

Admin -> Stores -> Configuration -> Advanced -> Developer

1] JavaScript Settings
    Merge JavaScript Files -> Yes
    Enable JavaScript Bundling -> Yes
    Minify JavaScript Files -> Yes

2] CSS Settings
    Merge CSS Files -> Yes
    Minify CSS Files -> Yes

Developer Mode:

https://cdn.domain.com/pub/static/adminhtml/Alphanova/Theme/en_US/requirejs/require.js

https://cdn.domain.com/pub/static/adminhtml/Alphanova/Theme/en_US/mage/requirejs/mixins.js

Production Mode:

https://cdn.domain.com/pub/static/adminhtml/Alphanova/Theme/en_US/requirejs/require.min.js

Admin is not working due to JS not loading. Above are just a few JS files.

https://cdn.domain.com/pub/static/adminhtml/Alphanova/Theme/en_US/mage/requirejs/mixins.min.js

In Production Mode I'm not able to locate the file on above location.

magento/pub/static/adminhtml/Custom/Theme/em_US // ALL FILES SHOULD BE HERE
magento/pub/static/adminhtml/Magento/backend/en_US // ALL FILES STAYS HERE

Magento 2 – Custom admin theme not working in production mode

https://github.com/magento/magento2/issues/3754

Best Answer

When creating a new custom theme, if we don't have any assets files under web folder, your theme may be ignored when executing deploy command.