How to point a Resource to a specific file?

I’m trying to migrate a Connect app to Forge. My current app is composed with Vite.js and it has multiple entry points configured, so it produces several html files for different parts of the app.
For example, it produces an index.html for the main interface, but then it builds a settings.html for the settings page, and an options.html for a Dialog modal.

When trying to migrate to Forge, the modules section of the manifest must be pointed to a resource key. But the resource key must only be a directory. The intention here is for each resource to be a different static app, but that would mean a lot of duplication, having several vite apps, and a huge overhead…

I’ve seen that there are hacks that detect the module loaded and some other data from view.getContext() in order to load different apps or parts of the app, but the problem with this approach is that it generates one huge bundle that gets loaded every time. So all the code for the settings page gets loaded (but not used) on the main app and on the dialog modal app. Which is such a waste…

So… is there a way to cleanly point a resource to a specific file? How would you resolve this?


One thing I tried and forgot to mention, is to make Vite produce its output as folders (similar to Astro): dist/main/index.html, dist/settings/index.html, dist/options/index.html.
The idea here would be to use different resource configurations, pointing to the various folders that are still being built by a single process.

There are two problems with this approach:

  1. The tunnel for local development is broken. When the tunnel is used, it completely replaces the entire resource path with the localhost:port url, and assumes all files are at the root. So, all resources end up pointing at the same entry point for local development. Which is not what we want.
  2. Even if we dismiss this, and develop entirely by using forge deploy, since the whole point of this is to have a single build and shared resources, the bundles are compiled to a dist/assets directory. But since this directory sits one level above the declared path for the resoruces (dist/settings), Forge does not allow that and it errors out with 403.

Any other ideas that might work?