Skip to content

Need help with some dependencies #6282

Answered by kengork
vibaiher-qatium asked this question in Q&A
Discussion options

You must be logged in to vote

We fixed it. We'll share how we make it work:

  1. To fix TypeError: Buffer2 is undefined we had to create an alias in vite.config.js like this: ` Buffer: "buffer". Then we installed a library called "buffer" and we imported the module wherever we needed it. This way we made sure we were using a buffer that works in the browser.
  2. After that we got an error rbush2 is not defined. It was related to one of our dependencies called @turf/line-split, as rbush was a dependency of this one. The cause of the error was that Vite wasn't compiling the require() inside of that library, because we're using ESM. So, we had to install a plugin called @originjs/vite-plugin-commonjs and target that dependency.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by vibaiher-qatium
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@br0k3nb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants