Support » Plugin: ReactPress - Create React App for WordPress » Issue running build App

  • Resolved ianuminc

    (@ianuminc)


    First of all thanks for the amazing plugin!

    I set up WP locally, create react App, was able to edit and building it. Then uploaded the files on remote server with Reactpress plugin installed. Everything worked fine but, when I try to see the result, it’s not working (see link connected).

    Browser is trying to get files from https://staging8.airlite.combuild/static/js/main.e61a907f.chunk.js?ver=1 missing a part of the path. The part of the path missing is /wp-content/plugins/reactpress/apps/calculator/

    As you can see from the PHP error notice, it seems that in the line
    132: $relative_apppath = explode($document_root, $plugin_app_dir_url)[1];
    there’s something unexpected. Any suggestion as a fix?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author rockiger

    (@rockiger)

    Hi ianuminc,

    it seems that the WP function plugin_dir_path(__FILE__) produces odd results or that $_SERVER['DOCUMENT_ROOT'] is not set.

    Just to make sure, could you add the following code:

    
    echo ('REPR_PLUGIN_PATH: ' . REPR_PLUGIN_PATH);
    echo ('<br />');
    echo ('$plugin_app_dir_url: ' . $plugin_app_dir_url);
    echo ('<br />');
    echo ('$relative_apppath: ' . $relative_apppath);
    

    To the file public/class-reactpress-publich.php at line 134 and show me the result?

    • This reply was modified 4 months, 2 weeks ago by rockiger.
    • This reply was modified 4 months, 2 weeks ago by rockiger.
    Thread Starter ianuminc

    (@ianuminc)

    Done! You can view the output at the same link ( https://staging8.airlite.com/calculator/ )

    For simplicity, I report the output also there:

    
    REPR_PLUGIN_PATH: /home/customer/www/staging8.airlite.com/public_html/wp-content/plugins/reactpress/
    $plugin_app_dir_url: /home/customer/www/staging8.airlite.com/public_html/wp-content/plugins/reactpress/apps/calculator/
    $relative_apppath:
    
    Plugin Author rockiger

    (@rockiger)

    Ok, I understand.

    Your $_SERVER['DOCUMENT_ROOT'] is not set. As a workaround I would propose the following solution: Change the code at line 132 like so:

    $relative_apppath = '/wp-content/plugins/reactpress/apps/calculator/';

    and remove the echos. Your app should run now. In the future I will add a new feature, that will allow you to input your React app folder.

    Let me know if this fixes your issues.

    Thread Starter ianuminc

    (@ianuminc)

    yes @rockiger , now it’s working, thank you so much!

    My only concern is that this website will be for a customer so if further update of your plugin will occur, that might break the functionality. If you can just leave a message in this thread when your proposed edit will be available, I’d highly appreciated that.

    Again, thank you so much for your huge support πŸ™‚

    Plugin Author rockiger

    (@rockiger)

    Yeah sure, will do. I updated the plugin the day before yesterday.

    Thread Starter ianuminc

    (@ianuminc)

    Thanks! πŸ™

    Plugin Author rockiger

    (@rockiger)

    @ianuminc

    I released a new version. It has a fallback for the apps directory. So it shouldn’t make any trouble.

    This release does change the way to use ReactPress and gives you much more control.

    Nonetheless, backward compatibility should be given.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.