Skip to content

Commit

Permalink
Merge pull request #189 from fedwiki/nrn/import
Browse files Browse the repository at this point in the history
Use dynamic import expression to load plugin code
  • Loading branch information
paul90 authored Jul 23, 2024
2 parents d6d1a37 + 678dacf commit 849d8c9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/plugins.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ module.exports = exports = (argv) ->
fs.exists server, (exists) ->
if exists
console.log 'starting plugin', plugin
try
plugins[plugin] = require server
import(server).then((exported) ->
plugins[plugin] = exported
plugins[plugin].startServer?(params)
catch e
).catch((e) ->
console.log 'failed to start plugin', plugin, e?.stack or e
)

startServers = (params) ->
# emitter = new events.EventEmitter()
Expand Down

0 comments on commit 849d8c9

Please sign in to comment.