#Need help making a plugin system

1 messages · Page 1 of 1 (latest)

gusty haven
#

I'm trying to implement a system for adding functionality to my app by allowing modules to be loaded at runtime from a custom directory.
The problem is that those modules are all meant to use a common library, which is bundled together with the application, in the public folder (this way I don''t have too many problems importing it in the plugins, since because those are going to be runtime loaded and won''t get bundled the imports must not require redirection)
This means that, because I'm using TypeScript, when I''ll be developing those plugins, in order to get support from VS Code, I''ll have to setup my source, make the plugins inside of it AND have temporary imports to to public/modules (which is where the library sits at in the source code) which will then need to be changed once I need to build, leaving the IDE with a sea of type not found and module cant be resolved errors, etc.
What I'm trying to say is that all of this feels incredibly sketchy and bad planned, so thats what im trying to address by asking here.
Any ideas?

dull basalt
#

my app
what kind of app? what situation does it run in? who loads the plugin?

gusty haven
#

a Tauri, which is powered by Rust. The app runs on desktops, on any folder, while the plugins are loaded from a directory besides the app in the same parent, with a predefined name. the plugins are going to be ts files, with predefined function names and type annotations and are all going to have a siimilar structure

#

sorry for not mentioning this previously

dull basalt
#

maybe try declaring global variables in the actual runtime, and using <reference> or an ambient ts file to get things to type properly