I think the BufferGeometryUtils you use it the wrong one. You should import like this:
import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js';
instead of
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils';
Doc here:
https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.mergeGeometries
I know this is deprecated but this may be easily updated right?