Importing and Using BufferGeometryUtils

Can someone explain how to properly use BufferGeometryUtils?

I get this error - export ‘BufferGeometryUtils’ (imported as ‘THREE’) was not found in ‘three’

I am importing using import * as BufferGeometryUtils from “three/examples/jsm/utils/BufferGeometryUtils”;

I would simply like to merge two buffer geometries together. Any advise? It seems to have changed a few times and has plagued many people before.

Thanks for the 2022 update!

1 Like

A typical import in vanilla JavaScript would be:

import * as BufferGeometryUtils from "three/examples/jsm/utils/BufferGeometryUtils.js";

Note the .js suffix at the end. If you’re using a bundler with different import resolution, or TypeScript, it might be OK to omit the .js extension. The intended syntax hasn’t changed, although some details affecting ES Modules support in bundlers has. If the syntax above doesn’t work you may need to share details like the bundler you’re using, its config, and the version of three.js.

3 Likes

https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils

import * as BufferGeometryUtils from ‘three/addons/utils/BufferGeometryUtils.js’