jQuery not bundled in Sage 10

Hello

We want to remove the jquery library provided by Wordpress and load our own.
So in filters.php we set:

function my_init() {
    if (!is_admin()) {
        wp_deregister_script('jquery');
        wp_register_script('jquery', false);
    }
}
add_action('init', __NAMESPACE__.'\\my_init');

In app.js jQuery get imported:

/**
 * External Dependencies
 */
import 'jquery';
import 'bootstrap';

Now when loading the page we get a JS error, that jquery is not available.
Why is jQuery not bundled in Webpack? I found som older posts in the forum referring to the webpack docs using externals, but cannot get it working in sage 10.

Would appreciate any suggestion.

Thanks
Aldo

You can declare some variables as being external, so the linter/builder don’t comlain about them being not improted. However, you still have to enqueue JQuery, preferably from WordPress core enregistered scripts.