citygml-to-3dtiles icon indicating copy to clipboard operation
citygml-to-3dtiles copied to clipboard

Error: require() of ES Module is not supported

Open pcace opened this issue 2 years ago • 3 comments

Hi,

i am trying to get your library to run in nodejs, but i am stuck importing it correctly. is the problem on my side or is something broken with the library? this is the errormessage:

Error: require() of ES Module C:\Users\user\Documents\citygmlToGltf\node_modules\citygml-to-3dtiles\src\Converter.mjs not supported.
Instead change the require of C:\Users\user\Documents\citygmlToGltf\node_modules\citygml-to-3dtiles\src\Converter.mjs to a dynamic import() which is available in all CommonJS modules.       

when having this in my app.ts:

import Converter from "citygml-to-3dtiles";
  let converter = new Converter();

(i also had to add a citygml-to-3dtiles.d.ts in node-module/@types) and added "type" : "module", to the package.json of the module... with no luck

any idea what i am doing wrong here?

Thanks a lot!

pcace avatar Nov 17 '22 10:11 pcace