Dynamic module or function loading across runspaces #1494
Labels
enhancement ⬆️
priority: medium
Important but not urgent. Should be addressed within a few releases
story-points: 5
Moderate effort. Medium-sized features, complex bug fixes, or API changes. Needs thorough review
Question
Hey @Badgerati - it's been awhile! Still loving using Pode. Wondering if you've run into this or have any ideas?
I'm trying to dynamically reload PowerShell modules/functions at runtime to avoid server restarts. Trying a middleware approach using
Use-PodeScript
fails with a null reference exception, for example:Up to this point, I've been using
Use-PodeFolder -DefaultPath $config.Paths.Functions
inmain.ps1
, but this only loads functions once across runspaces, requiring server restart to apply changes each time a function is updated. This takes on average about 10-12 seconds per restart, which creates a slow feedback loop. Related....I've managed to accomplish a similar "hot reloading" behavior with my routes by dot-sourcing route logic in (good for dev, probably not such a great practice in Prod), but the same thing isn't working here since the key difference is that I need current function definitions across all runspaces and it seemsUse-PodeFolder
andUse-PodeScript
andImport-PodeModule
aren't designed to support that.Are there any ways around this to effectively reload function definitions across all runspaces without server restart (perhaps using middleware or some other approach)?
The text was updated successfully, but these errors were encountered: