[wp-trac] [WordPress Trac] #45271: Can't enqueue WordPress 5.0 builtin reactjs

WordPress Trac noreply at wordpress.org
Tue Nov 6 04:19:02 UTC 2018


#45271: Can't enqueue WordPress 5.0 builtin reactjs
-----------------------------------------+-------------------------
 Reporter:  CantoThemes                  |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  5.0
Component:  Script Loader                |     Version:  5.0
 Severity:  normal                       |  Resolution:
 Keywords:  reporter-feedback has-patch  |     Focuses:  javascript
-----------------------------------------+-------------------------

Comment (by CantoThemes):

 @nerrad Is not about my script. It's a bug where react is not loading as
 it should be. Yesterday I tried to play with `wp-api-fetch` and I failed.
 `wp-api-fetch` is loading but `wp-polyfill-ecmascript` is not loading and
 `wp-api-fetch` got break. So anything inside of
 `wp_default_packages_vendor()` is not loading as default.

 If you want to reproduce this issue. Clean install a wordpress 5.0-beta3
 and then create `test.php` in plugins folder use this code and active this
 plugin and go to Test page in admin now try `React`.

 {{{#!php
 <?php
 /**
  * Plugin Name: Test
  * Plugin URI: https://github.com/WordPress/gutenberg
  * Description: Printing since 1440. This is the development plugin for
 the new block editor in core.
  * Version: 1.0.0
  * Author: Test
  */

 add_action( 'admin_menu', function() {
     $hook = add_menu_page( 'Test', 'Test', 'read', 'my-test', function ()
 {
             echo 'test';
     } );

     add_action( "load-$hook", function () {
             wp_enqueue_script( 'react' );
             wp_enqueue_script( 'react-dom' );
     } );
 } );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45271#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list