Skip to content

[Issue] Fix URL path of Sourcemap(.map) files #37290

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #28415: Fix URL path of Sourcemap(.map) files


Description (*)

Verified the problem and fix on Magento 2.4.5-p1 and 2.4-develop. The problem doesn't exist on Magento 2.3.7-p4 so probably one of the recent changes in 2.4.x to the grunt code or one of the updated npm packages causes the problem.

Steps to reproduce:

  1. Setup clean Magento
  2. Copy package.json.sample to package.json
  3. Run npm install
  4. Run cp Gruntfile.js.sample Gruntfile.js
  5. Run grunt exec:luma
  6. Run grunt less:luma
  7. Run: grep -r 'sourceMappingURL' pub/static and notice this output:
$ grep -r 'sourceMappingURL' pub/static
pub/static/frontend/Magento/luma/en_US/css/styles-l.css:/*# sourceMappingURL=pub/static/frontend/Magento/luma/en_US/css/styles-l.css.map */
pub/static/frontend/Magento/luma/en_US/css/styles-m.css:/*# sourceMappingURL=pub/static/frontend/Magento/luma/en_US/css/styles-m.css.map */

Which are incorrect paths to the sourcemap files, the browser tries to load these incorrectly resulting in 404 errors and doesn't find the original less files in the inspector:
Screenshot 2023-01-05 at 13 45 50

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Area: FrameworkIssue: 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.Progress: doneReported on 2.4.5-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions