The related library is registered with a function called wp_default_scripts.
File location (for WordPress 6.0): …wp-includes/script-loader.php
remove to remove the relevant script; The add function is used to add a new script.
/**
* Assigns default styles to $styles object.
*
* Nothing is returned, because the $styles parameter is passed by reference.
* Meaning that whatever object is passed will be updated without having to
* reassign the variable that was passed back to the same value. This saves
* memory.
*
* Adding default styles is not the only task, it also assigns the base_url
* property, the default version, and text direction for the object.
*
* @since 2.6.0
*
* @global array $editor_styles
*
* @param WP_Styles $styles
*/
add_filter( 'wp_default_scripts', 'remove_js_ui_library' );
function remove_js_ui_library( &$scripts){
if(!is_admin()){
$scripts->remove( 'jquery-ui-core');
}
}