31
HFS ~ HTTP File Server / Re: a new beginning...
« on: January 08, 2022, 09:04:15 AM »
The middleware plugin feature is completely well...
... But before I success I encountered a bug:
The function deleteModule in plugins.js is recursive,
but when a plugin have requires to Node/HFS native modules, a infinite recurse occurs.
So, only do recurse if it's a real "plugin" (or really need be deleted) and not deleted before.
(found this after debugging for half an hour )
And, consider a event-driven plugin structure? We can do almost everything with dom addEventListener, and also event.preventDefault
Don't forget the old "event script", too
... But before I success I encountered a bug:
The function deleteModule in plugins.js is recursive,
but when a plugin have requires to Node/HFS native modules, a infinite recurse occurs.
Code: [Select]
plugin error importing test.js RangeError: Maximum call stack size exceeded
To reproduce, a single "require" to HFS native module in a valid plugin can trigger this.So, only do recurse if it's a real "plugin" (or really need be deleted) and not deleted before.
(found this after debugging for half an hour )
And, consider a event-driven plugin structure? We can do almost everything with dom addEventListener, and also event.preventDefault
Don't forget the old "event script", too