Bud: js is loaded but the js code is not run in production


I manage to make Bud work on Sage 9. On production, though, I can see the JS is loaded but it is not fired. In dev mode, it’s fine.

Would you know why and could you help me fix it, please?

I assume it’s because of splitchunk, but I’m really unsure.

This is a preproduction version with the issue: https://preprod.magicrpm.com

Update your bud dependencies.

I fresh installed everything yesterday. All seems up to date. Do you have a specific dependency in mind?

Okay, I see the issue.

I did that to import my scripts:

add_action('wp_enqueue_scripts', function () {

    $filename =  asset_path('manifest.json');

    // Grab contents and decode them into an array
    $data = json_decode(file_get_contents($filename), true);
    $js = $data['app.js'];
    $home = $data['home.js'];
    wp_enqueue_script('app.js', asset_path($js), ['jquery'], null, true);
    wp_enqueue_script('home.js', asset_path($home), ['jquery'], null, true);
}, 100);

But I was missing runtime, and few chunks.

So I went back to this example repo: bud/functions.php at 48257486060cff94bc0aec9472a9846ee496c6af · roots/bud · GitHub

And I manage to make it work by changing a few things. I’ll post the full code file later :slight_smile: