tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.72k stars 2.55k forks source link

Support for vercel/pkg executable dependencies #2557

Open Verequies opened 3 years ago

Verequies commented 3 years ago

I am currently bundling a Linux AppImage, macOS app and Windows msi off which includes has a sidecar that is compiled with vercel/pkg and utilises the library lovell/sharp.

During compilation of the sidecar executable I receive the following warnings:

> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/build/Release
  %2: path-to-executable/sharp/build/Release
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/vendor/lib
  %2: path-to-executable/sharp/vendor/lib

In order for the executable to work properly I require the above directories in the resulting Tauri bundle next to the sidecar executable. Including the folder in the Tauri bundles resources does not work either.

At this point in time, I am not sure how to get this to work with Tauri, or if it is even possible.

lucasfernog commented 3 years ago

Can you share a repo that we can use to reproduce it? Though it seems like a usability issue rather than a tauri issue.

Verequies commented 3 years ago

I'll quickly create a project you can test it with.

Verequies commented 3 years ago

Here is a quick project I threw together: https://github.com/Verequies/tauri-pkg-test. Should be able to build it on Linux, macOS and Windows. Basically just spits the error from the backend sidecar into the Tauri window. It should look like this: image The executable packaged with vercel/pkg only runs if the node_modules folder is next to the executable, but as you can see in the project I can only add that in resources which is not next to the executable.

A solution might be to offer the ability to run a script after generating the folders to be bundled, but right before bundling. For example running a script right before building the AppImage.

Another solution might be to offer an entry in tauri.conf.json for pkg in order to specify dependency files/folders.