-
Couldn't load subscription status.
- Fork 2
Description
I've finally found the cause of this issue:
Refused to apply style from 'https://[REDACTED]/static/version1650349472/adminhtml/Magento/backend/en_US/JetRails_Varnish/css/source/_module.less' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
This is shown when visiting the login page (you do not need to log in) for any site using our module.
Upon review, the behavior is that the file does get compiled to var/view_preprocessed/pub/static/adminhtml/Magento/backend/en_US/JetRails_Varnish/css/source/, however, it does not get copied to pub/static/adminhtml/Magento/backend/en_US/JetRails_Varnish/css/source/ when deploying static content.
It turns out that Magento will only import less files in production mode for themes, not modules. Therefore, the problem is in this repo's view/adminhtml/layout/default.xml file. Rather than including the less file here, we need to include the CSS file. An example is described here - https://webkul.com/blog/use-less-magento-2-template-modules/
So the flow is like, when you defined custom.css, Magento finds the custom.css in app/code/Namespace/Module/view/frontend/web/ but it does not get success in finding that CSS file there, now it searches for file custom.less under app/code/Namespace/Module/view/frontend/web/ and if found then transform it to custom.css file and put in pub/static/….