How to import widgets from NPM package

we are trying to build a wordpress plugin to use Algolia on our website. When we try to npm install and import the modules like in the examples we get an error in our gulp setup.
We first installed the packages with npm install algoliasearch instantsearch.js.
Then we tried importing with:

import algoliasearch from "algoliasearch/lite";
import instantsearch from "instantsearch.js";
import { searchBox, referenceList, hits } from "instantsearch.js/es/widgets";

The first two lines seem to work but the third causes an error in the gulp setup:
export { default as analytics } from “./analytics/analytics.js”;
ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’

Our Gulp setup looks like this for the scripts:

const { src, dest, series, parallel, watch } = require("gulp");
const uglify = require("gulp-terser");
const sass = require("gulp-sass")(require("node-sass"));
const sourcemaps = require("gulp-sourcemaps");
const autoprefixer = require("gulp-autoprefixer");
const wait = require("gulp-wait");
const browserify = require("browserify");
const babelify = require("babelify");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const rename = require("gulp-rename");
const glob = require("glob");
const es = require("event-stream");

function scriptsDev(done) {
  glob("./src/js/*.js", function (err, files) {
    if (err) done(err);
    const tasks = (entry) {
      return browserify({ entries: [entry] })
            dirname: "",
        .pipe(sourcemaps.init({ loadMaps: true }))
    es.merge(tasks).on("end", done);

Is there a change we can make in the gulpfile or in the import to get this working?

I’m not super familiar with Gulp, but this seems to be related to the babelify piece:

There seems to be a lot of troubleshooting advice in this thread: