Enqueueing JS files

Thanks for the suggestions. I find it interesting that both code returns different paths for me.

use function Roots\bundle;

bundle('sample')->enqueue();
// returns public/scripts/sample.js

wp_enqueue_script('sample.js', asset('sample')->uri(), false, null);
// works and returns public/js/sample.js

Also, I am trying to get this to conditionally load only when a block is added, but doesn’t seem to work.

if ( ! wp_script_is( 'sample.js', 'enqueued' ) ) {
  ....
}

Hmm. Still needs a fair bit of investigation.