Exported Module Functions are not Working in Node.js
vedprad1 (836)

I was working on a program that involved my own module. While I was testing it, though, I realized that an exported function that I was working on had stopped working.

I created a new repl with a simplified module, and that yet still does not work. Can anyone see where the error is? I appreciate all the help!

The error: oof.hello is not a function


For some reason, the simplified repl has started working, but the program I am working on has not. I have posted it here.

You are viewing a single comment. View All
malvoliothegood (432)

Line 7 is your problem module.exports = (d, t) => {
Have a look at this page. It shows how to create a node module and import functions that it contains: https://www.tutorialkart.com/nodejs/create-a-nodejs-module/

vedprad1 (836)

@malvoliothegood : I still do not see the problem. Isn't my code correct?

vedprad1 (836)

@malvoliothegood : Thanks for your help, but I still do not get the problem with the module.exports function. I have decided to turn that into a regular exported function instead, so there is no problem now.

Thanks for your help, though.