#58660 closed defect (bug) (fixed)
Block editor fails to initialize when loading minified scripts
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.3 | Priority: | high |
| Severity: | blocker | Version: | 6.3 |
| Component: | Editor | Keywords: | has-patch |
| Focuses: | Cc: |
Description
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.
2 years ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core by joemcgill. View the logs.
2 years ago
joemcgill commented on PR #4742:
2 years ago
#3
I've overwritten the original change so that this PR excludes changes to the built PHP files that were originally present.
#4
@
2 years ago
Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/4742
Steps to Reproduce or Test
- Check out PR branch.
- Run
npm install && npm run build:dev. - In
wp-config.php, setSCRIPT_DEBUGtofalse. - Load the editor in a post or site editor.
Expected Results
- ✅ The editor should load without error.
Environment
- 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_DEBUGisfalse:
DevTools failed to load source map: Could not load content for http://wp-src.test/wp-admin/hooks.js.map: 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/underscore-umd.js.map: 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&dir=ltr&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&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&load%5Bchunk_2%5D=board,list-tables,edit,revisions,media,themes,about,nav-menus,wp-pointer,widgets,site-icon,l10n,wp-auth-check&ver=6.3-alpha-56078-src" media="all">
- When
SCRIPT_DEBUGis set totrue, only theunderscore-umd.js.mapnotice remains.
#5
@
2 years ago
- Owner set to joemcgill
- Resolution set to fixed
- Status changed from new to closed
In 56097:
joemcgill commented on PR #4742:
2 years ago
#6
This was added in https://core.trac.wordpress.org/changeset/56097.
Trac ticket: https://core.trac.wordpress.org/ticket/58660