Skip to content

JS Minification issue & requirejs loading in production mode in 2.4.7  #38829

Open
@KrzysztofWisniewskiAcc

Description

@KrzysztofWisniewskiAcc

Preconditions and environment

  1. Magento community/commerce version: 2.4.7
  2. Firefox browser (I was able to reproduce this on other browsers, but in firefox, the issue occurs almost all the time)

Steps to reproduce

  1. Install fresh Magento version of 2.4.7
  2. Enable js minification (there are few ways to do it, I edit the config.php/env.php file)
    ...
'system' => [
        'default' => [
            'dev' => [
                'template' => [
                    'minify_html' => '1'
                ],
                'js' => [
                    'merge_files' => '0',
                    'minify_files' => '1',
                    'enable_js_bundling' => '0'
                ],
                'css' => [
                    'minify_files' => '1'
                ],
                'grid' => [
                    'async_indexing' => '1'
                ]
            ],
        ]
    ]
  1. Run:
bin/magento setup:upgrade
bin/magento deploy:mode:set production
  1. Now go to front and open the console, errors should be there
  2. If errors are not there refresh the page few times,

Best is to use Firefox, as the errors there appear almost always.
The errors appear rarely in other browsers.

image

The first error:
The resource from “http://magento.clean/static/version1718361386/frontend/Magento/luma/en_US/mage/common.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

These errors do not occur on magento 2.4.5

I did not test this on magento 2.4.6 so it may be that the issue also occurs there.

Expected result

There are no errors in console.
The files are not loaded twice.
Only minified files are loaded.

Actual result

There are errors in console.
Files are loaded twice
.min files & their corresponding 'not minified' are being requested (which fails to load as not minified files, don't exists in pub directory after setup:static-content:deploy) .

image

image

Additional information

I noticed the issue when upgrading from 2.4.4-p8 to 2.4.7 so not quite sure if this started to happen with 2.4.7 release or 2.4.6

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Admin UIComponent: Framework/RequireJsIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions