ThatOpen / web-ifc-three

The official IFC Loader for Three.js.
https://ifcjs.github.io/info/
MIT License
517 stars 133 forks source link

Incorrect import in JS on NPM #64

Closed alex-moon closed 2 years ago

alex-moon commented 2 years ago

Steps to reproduce:

  1. npm install web-ifc-three
  2. import {IFCLoader} from 'web-ifc-three/IFCLoader';

Expected: code compiles Actual:

ERROR in ./node_modules/web-ifc-three/IFCLoader.js 8:9-30
"export 'mergeBufferGeometries' was not found in 'three/examples/jsm/utils/BufferGeometryUtils'

Solution - in IFCLoader.js:

- import { mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils';
+ import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtils';

const IdAttrName = 'expressID';
const merge = (geoms, createGroups = false) => {
-  return mergeBufferGeometries(geoms, createGroups);
+  return BufferGeometryUtils.mergeBufferGeometries(geoms, createGroups);
};

I would make a PR but I don't know how this JS file is generated I'm sorry.

alex-moon commented 2 years ago

Have made a PR: https://github.com/IFCjs/web-ifc-three/pull/65

agviegas commented 2 years ago

Hey, have you updated three.js? In the last version they changed the API and now the BufferGeometry API is like the current implementation of the library.