Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#58660 closed defect (bug) (fixed)

Block editor fails to initialize when loading minified scripts

Reported by: azaozz's profile azaozz Owned by: joemcgill's profile joemcgill
Milestone: 6.3 Priority: high
Severity: blocker Version: 6.3
Component: Editor Keywords: has-patch
Focuses: Cc:


Happens when SCRIPT_DEBUG = false. Seems the block-library.js file wasn't minified properly.

Throws these errors:

Uncaught SyntaxError: unexpected token: ':'       block-library.min.js:14:127081
Uncaught TypeError: i is undefined                edit-post.min.js:7:123891

Change History (6)

This ticket was mentioned in PR #4742 on WordPress/wordpress-develop by joemcgill.

10 months ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by joemcgill. View the logs.

10 months ago

joemcgill commented on PR #4742:

10 months ago

I've overwritten the original change so that this PR excludes changes to the built PHP files that were originally present.

#4 @ironprogrammer
10 months ago

Test Report

Patch tested:

Steps to Reproduce or Test

  1. Check out PR branch.
  2. Run npm install && npm run build:dev.
  3. In wp-config.php, set SCRIPT_DEBUG to false.
  4. Load the editor in a post or site editor.

Expected Results

  • ✅ The editor should load without error.


  • Hardware: MacBook Pro Apple M1 Pro
  • OS: macOS 13.4.1
  • Browser: Safari 16.5.1, Google Chrome 114.0.5735.133
  • Server: nginx/1.25.0
  • PHP: 7.4.33
  • WordPress: 6.3-alpha-56078-src

Actual Results

  • ✅ Editor loads without PHP errors.

Additional Information

  • The following JS warnings were logged in the console when SCRIPT_DEBUG is false:

DevTools failed to load source map: Could not load content for http://wp-src.test/wp-admin/ Unexpected token '<', "<!DOCTYPE "... is not valid JSON

DevTools failed to load source map: Could not load content for http://wp-src.test/wp-includes/js/ Unexpected token '<', "<!DOCTYPE "... is not valid JSON

was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.
<link rel="stylesheet" href="http://wp-src.test/wp-admin/load-styles.php?c=0&amp;dir=ltr&amp;load%5Bchunk_0%5D=dashicons,admin-bar,wp-components,wp-block-editor,wp-reusable-blocks,wp-editor,common,forms,wp-reset-editor-styles,wp-block-libr&amp;load%5Bchunk_1%5D=ary,wp-block-editor-content,wp-edit-blocks,wp-edit-site,wp-format-library,buttons,media-views,wp-block-directory,admin-menu,dash&amp;load%5Bchunk_2%5D=board,list-tables,edit,revisions,media,themes,about,nav-menus,wp-pointer,widgets,site-icon,l10n,wp-auth-check&amp;ver=6.3-alpha-56078-src" media="all">

  • When SCRIPT_DEBUG is set to true, only the notice remains.

#5 @joemcgill
10 months ago

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

In 56097:

Build/Test Tools: Update terser-webpack-plugin.

This bumps the terser-webpack-plugin dependency to version 5.3.9, which fixes an error during the minification process of the @wordpress/block-library package during builds.

Props clorith, azaozz, desrosj.
Fixes #58660, See #57657.

Note: See TracTickets for help on using tickets.