Multisite plugin development and wp_enqueue_script

As @Even commented, instead of url_to_postid(), you should be using something like this:

if ( ! is_single() ) {
    return;
}

$post = get_post();

url_to_postid() is a round-about way of getting the ID of the current post, when WordPress has already determined what the current post is, i.e., it has already parsed the URL to get the post ID.