Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jquery.validate.js does not get minified correctly #36013

Open
5 tasks
git-seb opened this issue Aug 24, 2022 · 38 comments
Open
5 tasks

jquery.validate.js does not get minified correctly #36013

git-seb opened this issue Aug 24, 2022 · 38 comments
Assignees
Labels
Area: Performance Component: RequireJs Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@git-seb
Copy link

git-seb commented Aug 24, 2022

Preconditions and environment

  • Magento 2.4.5
  • PHP 8.1
    Did a pagespeed test and shows jquery.validate.min.js should be optimized. (I have JS minify turned on) Checking the actual file jquery.validate.min.js it is indeed incorrectly minified.
    jquery validate min js wrong

How it should be:
jquery validate min js right

Don't have deep knowledge of Magento but this is all the info I can provide.

Steps to reproduce

  1. Turn on Minify JS files
  2. Do a Google PageSpeed test
  3. Shows result saying jquery.validate.min.js minification could be improved
  4. When checking the actual file jquery.validate.min.js it is indeed incorrectly minified

Expected result

Minify jquery.validate.min.js correctly

Actual result

Minification of jquery.validate.min.js is incorrect
jquery validate min js wrong

Additional information

No response

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”.
@m2-assistant
Copy link

m2-assistant bot commented Aug 24, 2022

Hi @git-seb. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@git-seb git-seb changed the title jquery.validate does not get minified correctly jquery.validate.js does not get minified correctly Aug 24, 2022
@engcom-Hotel engcom-Hotel added Reported on 2.4.5 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it labels Aug 25, 2022
@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4.5 instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Lima
Copy link
Contributor

Hi @git-seb

We have tried to reproduce this issue
Precondition:
• Magento 2.4-develop && 2.4.5
• PHP 8.1

We have followed below steps
1.We have enabled Minify JavaScript Files as shown below

image

2.After we run the frontend url in Google PageSpeed
image

  1. We have checked the jquery.validate.min.js is passed (checked in both mentioned M2 versions)

image

Please let us know if we are missing any steps here.

Thanks

@engcom-Lima engcom-Lima added the Issue: needs update Additional information is require, waiting for response label Aug 29, 2022
@git-seb
Copy link
Author

git-seb commented Aug 29, 2022

Hi @engcom-Lima,

as you can see on your last screenshot, Google says jquery.validate.min.js can be optimized even though it is stated as passed. If you check that file you can see it is not minified correctly (see link https://22dcddfc581ace05c5c80fae5246308c.instances.magento-community.engineering/static/version1661761332/frontend/Magento/luma/en_US/jquery/jquery.validate.min.js from your instance).

Thanks.

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4.5 instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4.4 instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

Hi @engcom-Hotel, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@engcom-Lima
Copy link
Contributor

✔️ Issue confirmed

Issue got reproduced in 2.4-develop && 2.4.5 branch.

Description:
After enabling the Minify JavaScript Files in magento, the jquery.validate.js file is partially minified.

Prerequisite:

  • Magento 2.4.5 && 2.4-develop .
  • PHP 8.1

Steps to Reproduce:

  1. Enable Minify JavaScript Files in magento.
  2. Run the frontend url in Google PageSpeed
  3. Check the jquery.validate.js.

Expected result:
jquery.validate.min.js file should be minified correctly
Actual result:
jquery.validate.min.js file incorrectly minified
Screenshots:

Checked both M2 versions

image

Hence,confirming the issue.

Thanks

@m2-assistant
Copy link

m2-assistant bot commented Aug 30, 2022

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento magento deleted a comment from github-jira-sync-bot Sep 1, 2022
@sdzhepa sdzhepa added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Sep 1, 2022
@rostilos
Copy link
Contributor

rostilos commented Sep 9, 2022

@magento I am working on this

@JelleGe
Copy link

JelleGe commented Apr 24, 2023

Any update on this issue?

@rostilos
Copy link
Contributor

rostilos commented Apr 24, 2023

I found the root of the error, but it is not in the m2 files, but in third-party files/libs ( jquery libs or in the minifactor itself). Maybe I could deliver some plugin later ( There is a certain regular expression in the jquery.validate file that stops execution when approached by the minifier

@rostilos
Copy link
Contributor

rostilos commented May 1, 2023

tedious/JShrink#110
For now, I'm following the updates here. I think it makes sense to wait until the original module has this problem solved and update it to the latest version.

@minhluan259
Copy link

minhluan259 commented Jan 22, 2024

Simply solve it by updating JShink:

cd project_root 
cd vendor/magento/framework/
composer require tedivm/jshrink ^1.7 --no-update
cd project_root 
composer update

@rostilos
Copy link
Contributor

rostilos commented Jan 22, 2024

@minhluan259
Thank you. I will create a separate MR a little later ( if updating the module really solves the problem )

@git-seb
Copy link
Author

git-seb commented Jan 22, 2024

@minhluan259 Thanks for your input. That means fixing this issue is by updating the JShrink plugin from 1.4 to 1.7. I do think Magento devs have not done that yet because in version 1.5 of JShrink PHP 7.0 support dropped. Starting from Magento 2.4.6 (june 2023), the devs dropped support for PHP 7.4 but left JShrink unchanged. That is just assuming tho.

Side note for others, when doing this command, the following also installed/updated (at least on my 2.4.6-p3 environment):

  • Installing composer/ca-bundle (1.4.0): Extracting archive
  • Installing symfony/finder (v6.4.0): Extracting archive
  • Installing composer/pcre (3.1.1): Extracting archive
  • Installing composer/class-map-generator (1.1.0): Extracting archive
  • Installing composer/metadata-minifier (1.0.0): Extracting archive
  • Installing composer/semver (3.4.0): Extracting archive
  • Installing composer/spdx-licenses (1.5.8): Extracting archive
  • Installing psr/log (2.0.0): Extracting archive
  • Installing composer/xdebug-handler (3.0.3): Extracting archive
  • Installing symfony/deprecation-contracts (v3.4.0): Extracting archive
  • Installing justinrainbow/json-schema (v5.2.13): Extracting archive
  • Installing psr/container (1.1.2): Extracting archive
  • Installing symfony/polyfill-mbstring (v1.28.0): Extracting archive
  • Installing symfony/polyfill-ctype (v1.28.0): Extracting archive
  • Installing symfony/polyfill-intl-normalizer (v1.28.0): Extracting archive
  • Installing symfony/polyfill-php80 (v1.28.0): Extracting archive
  • Installing symfony/process (v5.4.34): Extracting archive
  • Installing symfony/polyfill-php81 (v1.28.0): Extracting archive
  • Installing symfony/polyfill-php73 (v1.28.0): Extracting archive
  • Installing symfony/filesystem (v6.4.0): Extracting archive
  • Installing symfony/polyfill-intl-grapheme (v1.28.0): Extracting archive
  • Installing symfony/string (v6.4.2): Extracting archive
  • Installing symfony/service-contracts (v3.4.1): Extracting archive
  • Installing symfony/console (v5.4.34): Extracting archive
  • Installing seld/signal-handler (2.0.2): Extracting archive
  • Installing seld/phar-utils (1.2.1): Extracting archive
  • Installing seld/jsonlint (1.10.1): Extracting archive
  • Installing react/promise (v3.1.0): Extracting archive
  • Installing composer/composer (2.6.6): Extracting archive
    And asked for this: "magento/composer-dependency-version-audit-plugin contains a Composer plugin which is currently not in your allow-plugins config. Do you trust to execute code and wish to enable it now?"

Tomorrow I will confirm if this fixes it or not as I yet have to deploy this on the production I am running.

@git-seb
Copy link
Author

git-seb commented Jan 23, 2024

The following error was showing up when compliming:
Application code generator... 3/9 [=========>------------------] 33% 11 secs 386.0 MiBPHP Fatal error: Cannot declare trait Composer\Repository\CanonicalPackagesTrait, because the name is already in use in /vendor/magento/framework/vendor/composer/composer/src/Composer/Repository/CanonicalPackagesTrait.php on line 23

I've reverted version 1.7 back to 1.4 and did composer reinstall magento/framework in root folder. I think this happened because of some dependencies. Not sure.. Maybe someone else can include it in a different way and test it?

@minhluan259
Copy link

minhluan259 commented Jan 23, 2024

@git-seb If you are using Magento 2.4.6-p3, just run composer update in the project folder. It will automatically update JShrink to v1.7

@git-seb
Copy link
Author

git-seb commented Mar 15, 2024

Just wanted to give a heads up on this thread. This is not yet fixed. Even after updating to Jshrink v1.7. I can confirm on multiple production environments.

@sgautamrave
Copy link

Hi,
Did we get any solution for this issue?

@nioupola
Copy link

Hello,

We are facing the same issue. Any progress about a merge about it?

@engcom-Hotel
Copy link
Contributor

As the issue is quite old, we rechecked this issue and found that the issue is relevant.

Hence we are reconfirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Oct 9, 2024
@github-jira-sync-bot
Copy link

❌ Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-6594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Performance Component: RequireJs Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: dev in progress Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Dev In Progress
Development

No branches or pull requests

10 participants