magento2: Magento 2.4.4 admin panel - Uncaught SyntaxError: Unexpected token 'const'
Summary (*)
Magento 2.4.4 running on PHP 8.1 in Production mode
If you enable the js bundling and minify the scripts.
php bin/magento config:set dev/js/minify_files 1
php bin/magento config:set dev/js/enable_js_bundling 1
After running the deployment and logging into the admin panel. We can’t click on any menue option. There is an error in the browser console: Uncaught SyntaxError: Unexpected token ‘const’
Preconditions (*)
- PHP 8.1
- Magento 2.4.4, 2.4-develop
- Magento instace should be in production mode
Steps to reproduce (*)
- Enable JS bundling.
- Minify the JS files
- Run deployment
- Login to the admin panel.
Expected result (*)
We should be able to access admin panel without any error.
Actual result (*)
We are getting the following error and not able to click on any menu option:

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- 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”.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 15 (3 by maintainers)
Is someone working on a PR to fix this?
Here is the solution:- lib/web/jquery/bootstrap/collapse.js @@ -32,7 +32,7 @@ define([ const VERSION = ‘5.1.3’ const NAME = ‘collapse’ const DATA_KEY = ‘bs.collapse’ const EVENT_KEY =
.${DATA_KEY}
const EVENT_KEY =.${DATA_KEY}
; const DATA_API_KEY = ‘.data-api’@@ -45,17 +45,17 @@ define([ parent: ‘(null|element)’ }
@@ -204,10 +204,10 @@ define([ }
@@ -222,7 +222,7 @@ define([
and
lib/web/jquery/bootstrap/tab.js
@@ -28,14 +28,14 @@ define([ const VERSION = ‘5.1.3’ const NAME = ‘tab’ const DATA_KEY = ‘bs.tab’ const EVENT_KEY =
.${DATA_KEY}
const EVENT_KEY =.${DATA_KEY}
; const DATA_API_KEY = ‘.data-api’Direct link: https://github.com/softinfoline/magento2/blob/be6341ebd31e0b67f6339714ac570689b88c8016/lib/web/jquery/bootstrap/collapse.js https://github.com/softinfoline/magento2/blob/d864fc370673453bf82f4e5f546f732224fe6880/lib/web/jquery/bootstrap/tab.js
Magento have provided me with the following patch for this: https://gist.github.com/ssx/275bc6c9674277ed8d26592235f1cc6b
Issue still present on 2.4.4-p3
Hi. Also facing this issue in 2.4.4-p2
This is still present in 2.4.4-p2