bugra9 / gdal3.js

Convert raster and vector geospatial data to various formats and coordinate systems entirely in the browser.
https://gdal3.js.org
GNU Lesser General Public License v2.1
300 stars 45 forks source link

Monorepo support - ENOENT: no such file or directory, open gdal3WebAssembly.data' #76

Open alexcroox opened 1 month ago

alexcroox commented 1 month ago

I have a monorepo with FE and BE in src/packages(client/server)

I'm importing gdal3.js in Node v20 (src/packages/server):

import initGdalJs from 'gdal3.js/node.js'

but I'm getting:

ENOENT: no such file or directory, open './node_modules/gdal3.js/dist/package/gdal3WebAssembly.data'

bugra9 commented 1 month ago

Hi @alexcroox,

By default it searches for data file in node_modules/gdal3.js/dist/package/. Can you try to set correct path in config?

For example; initGdalJs({ path: '../node_modules/gdal3.js/dist/package/' })

https://gdal3.js.org/docs/global.html#initGdalJs