Magento 2.4.2 admin invoice does not render the CSS on certain invoices - the page shows up without any styling. (Some older invoices do still render properly as they should). So it seems that the code errors in certain circumstances.
To see the invoice: Magento admin > sales > invoice then click on VIEW ( Any of the invoice)
I don't see any Log Errors in this regard.
Browser Console Error says "uncaught reference error: require is not defined"
The "require is not defined" is after the first line: <script>require(['prototype'], function(){
The referenced code is:
<script>require(['prototype'], function(){
submitComment = function() {
submitAndReloadArea($('comments_block').parentNode, 'https\u003A\u002F\u002Fwww.EXAMPLEDOMAIN.com\u002Fcgscp2\u002Fsales\u002Forder_invoice\u002FaddComment\u002Fid\u002F4650\u002Fkey\u002F359a264374d55ffc26772041f6b5e9e90434d8b1da91d085acebb4ccaf28a36a\u002F')
};
if ($('submit_comment_button')) {
$('submit_comment_button').observe('click', submitComment);
}
});</script>
So since the page loads fine with some invoices and not others, I'm guessing the code is perhaps buggy with its [comment submission] script section. Not sure.
Any help will be greatly appreciated.