#Access frontendDist from Rust

1 messages · Page 1 of 1 (latest)

sleek juniper
#

Hi, I want to expose part of my frontend over a web interface for remote access as well as local, it'd be nice if I didn't have to bundle it twice, is there a way I can get the contents of frontendDist from Rust, I can't figure out how to get the path.

latent wasp
#

Hey, for me understanding it more explicitly: you want to expose the files themselves or do you want to serve the content via webserver? Do you need to expose Tauri commands or just frontend code wiethout API access?

sleek juniper
#

just frontend code without API access, I didn't think that was something I could do within Tauri so I was trying to use axum. The issue I was having basically comes down to https://github.com/tauri-apps/tauri/issues/8411

GitHub

Describe the problem It took me quite a while to figure out how AssetResolver is used because it seems to produce no result. Only after studying the source code I realized that this behavior is spe...

latent wasp
#

So you have solved the exposure for production builds (with a workaround in dev)?

sleek juniper
#

yes

latent wasp
#

Great, I'll try to add this note to the documentation for now and poke some other devs if that's a quick fix. Otherwise PRs are always welcome.

sleek juniper
#

thanks, the documentation thing would make a big difference, maybe once I understand Tauri a bit better I'll try for a PR, for now I'm very new to this project

#

another thing I couldn't find in the documentation is the difference between assets and resources, in colloquial english those are almost synonymous and the distinction in tauri isn't really laid out anywhere

latent wasp
#

For reference: Where did you encounter this usage to be confusing? Are both words used in the same context/document?

sleek juniper
#

You have an AssetResolver class and an assetProtocol in tauri.conf.json and then you separately have a resources section of tauri.conf.json and a PathResolver class. I believe that assets are the contents of frontendDist which are embedded in the executable (in prod builds) and resources are separate files, bundled with but not embedded in the exectuable, and not part of the frontend.

latent wasp
#

Agreed that we should add some nomenclature/addition to our docs around this 👍 I understand it the same way but afaik only resources are described whereas assets are not explicitly explained.

Tauri

The cross-platform app building toolkit

sleek juniper
#

yes, agreed, I kept coming back to that page and finding it wasn't quite what I wanted

latent wasp
sleek juniper
#

Done