The Divi Builder plugin is a fantastic tool for adding endless layouts to your pages and posts, we use the Divi Builder plugin on this site as it provides a quick and easy way to build rich, beautiful layouts. The downside to Divi Builder is that it comes with a heavy page load on all pages of your site by default even if the page/post isn’t using the builder.

We only use the Divi Builder on certain posts and pages so had no need for the scripts and styles to be enqueued on all pages. We wrote this quick function to dequeue the divi builder scripts unless the page builder is active on the current page/post.

Divi Page Builder Dequeue scripts unless the page builder is active on current page:

function deregister_script() {
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );

if( !$is_page_builder_used ) {
wp_dequeue_script('et-builder-modules-global-functions-script');
wp_dequeue_script('google-maps-api');
wp_dequeue_script('divi-fitvids');
wp_dequeue_script('waypoints');
wp_dequeue_script('magnific-popup');

wp_dequeue_script('hashchange');
wp_dequeue_script('salvattore');
wp_dequeue_script('easypiechart');

wp_dequeue_script('et-jquery-visible-viewport');

wp_dequeue_script('magnific-popup');
wp_dequeue_script('et-jquery-touch-mobile');
wp_dequeue_script('et-builder-modules-script');
}
}
}
add_action( 'wp_print_scripts', 'deregister_script', 100 );

Divi Page Builder Dequeue styles unless the page builder is active on current page:

function deregister_styles() {
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );

if( !$is_page_builder_used ) {
wp_dequeue_style('et-builder-modules-style');
}
}
add_action( 'wp_print_styles', 'deregister_styles', 100 );

You can place the functions in your theme functions.php file or create a MU plugin for them.

Please note this is for the Divi Builder plugin and not the Divi Theme