WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#46218 closed defect (bug) (fixed)

404 error in source mapping in jquery.form.min.js

Reported by: valicesupport Owned by: peterwilsoncc
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.1
Component: Build/Test Tools Keywords: has-patch has-unit-tests commit dev-feedback
Focuses: Cc:

Description

Source map error: request failed with status 404

In the latest version of WordPress, the jquery.form.min.js file is referencing a sourceMappingURL at the bottom of the file.

Attachments (2)

46218.diff (3.5 KB) - added by pento 3 months ago.
46218.2.diff (3.9 KB) - added by peterwilsoncc 3 months ago.

Download all attachments as: .zip

Change History (8)

#1 @pento
3 months ago

  • Component changed from General to Build/Test Tools
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.1
  • Version changed from 5.0.3 to trunk

Thank you for the bug report, @valicesupport!

This is caused by the build process (grunt copy:npm-packages) copying the minified files from the packages that it's importing, rather than using the uglify part of the build process.

@pento
3 months ago

#2 @pento
3 months ago

  • Keywords has-patch has-unit-tests commit dev-feedback added; needs-patch removed

In 46218.diff:

  • Don't copy jquery.form.min.js from node_modules, uglify it from jquery.form.js.
  • Add a unit test to ensure all JS files in the build directory don't contain a sourceMappingURL directive.
  • Remove the ad-hoc unit tests that check backbone.min.js and jquery.js for a sourceMappingURL.

The unit test allows sourceMappingURL=data:... URIs, as these won't cause an extra HTTP request.

#3 @peterwilsoncc
3 months ago

In 46218.2.diff:

  • adds uglify:jqueryform to uglify:all and precommit:js tasks
  • otherwise identical to original patch

I've tested both the grunt watch and grunt build commands to ensure the file is included. It is.

#4 @peterwilsoncc
3 months ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 44740:

Build: Remove source map from jquery.form.min.js.

Minimize jquery.form.js as part of build process to remove the source map reference.

Modify source map tests to include all JavaScript files rather than testing Backbone and jQuery only.

Props pento.
Fixes #46218.

#5 @peterwilsoncc
3 months ago

In 44744:

Build: Fix formatting issues introduced in [44740].

See #46218.

#6 @peterwilsoncc
3 months ago

In 44745:

Build: Fix formatting issues introduced in [44740].

Merges [44744] to the 5.1 branch.
See #46218.

Note: See TracTickets for help on using tickets.