libsql-js icon indicating copy to clipboard operation
libsql-js copied to clipboard

Statically import libsql targets

Open msanchezdev opened this issue 11 months ago • 3 comments

I am not sure if there are more targets, but developing with bun using the single-file executable mode the libsql driver fails to be imported from the embedded file system as Bun doesn't detect what files are to be imported if done dynamically.

As the code dynamically imports the proper target module we can get a false positive if the built file is run in a project that has the node_modules/@libsql/* target folders so it's recommended to test this by copying the binary file to another directory or simply running it from somewhere else:

e.g: image

Image Error Transcript:

error: Cannot find module "@libsql/linux-x64-gnu" from "/$bunfs/root/test-build"

msanchezdev avatar Mar 11 '24 04:03 msanchezdev

Oh, nice @msanchezdev! Does it mean we can drop the @neon-rs/load dependency too?

penberg avatar Mar 11 '24 12:03 penberg

@penberg I wasn't sure about neon, have to check how it works, but I am trying another approach now as this way it actually seems to be bundling all into the binary

msanchezdev avatar Mar 11 '24 12:03 msanchezdev

Hey, there are any updates regarding this? It would be nice to drop the @neon-rs/load dependency!

giovannibenussi avatar May 02 '24 10:05 giovannibenussi