NodeBB libraries not accessible in plugin?
-
I'm trying to follow the basic tutorial on writing nodebb plugins.
But I'm using
module.parent.require('./database')
in my plugin but it isn't working.It simply says:
Error: Cannot find module './database'
Can anyone point me to the issue?
-
I'd suggest using
require.main.require('./src/database')
instead -
@asamolion
module.parent.require
also works fine. It depends whether you are calling it from a dependent file, or from the main plugin library file. -
Also, just FYI, the docs you used are the old docs, the new ones are at docs.nodebb.org
You can open an issue at github.com/nodebb/docs if you wish for a change to be made
Copyright © 2024 NodeBB | Contributors