magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

Grunt Less uses pub/ prefix for sourcemaps #38837

Closed gwharton closed 4 weeks ago

gwharton commented 3 months ago

Summary

When using grunt to generate css, the associated sourcemaps use the prefix pub/ on all urls it generates. This forces the webserver config to employ a workaround to allow pub/ urls to continue to work, just for the sourcemaps. Sourcemaps should not use the pub/ prefix.

Examples

Deploy Vanilla 2.4.7-p1

cp Gruntfile.js.sample Gruntfile.js php bin/magento deploy:mode:set development grunt clean grunt exec grunt less less pub/static/frontend/Magento/luma/en_US/css/styles-l.css.map

Observe the paths include pub/static

Browse to the frontend and inspect an element in the dev console. Check the location of the less file obtained via the sourcemap

vDLOkBHE70

Although this will still work if your nginx config includes the following snippet

https://github.com/magento/magento2/blob/91cb4d46834b88bb8dc9f5b06279a63d9ad0963c/nginx.conf.sample#L98C1-L104C2

But isn't the use of /pub/ urls now unsupported?

Proposed solution

No response

Release note

less/css sourcemaps generated by grunt no longer use the /pub prefix for paths.

Triage and priority

m2-assistant[bot] commented 3 months ago

Hi @gwharton. Thank you for your report. To speed up processing of this issue, 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:

hostep commented 3 months ago

Nice find, here's a fix: https://github.com/magento/magento2/pull/38840

m2-assistant[bot] commented 3 months ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 3 months ago

Hello @gwharton,

Thanks for the report and collaboration!

We have tried to reproduce the issue in the Magento 2.4-develop (latest development branch) and the issue is reproducible for us. Please refer to the below screenshot:

image

Hence confirming the issue.

Thanks

github-jira-sync-bot commented 3 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12189 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 months ago

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