0

I want to make function calls from app.js to another js file in the same project without using modeule.export. Is there a way to do so? Possibly by including the file in package.json?

I'm not able to find a way to include other js files in package.json "scripts" list. Maybe that would allow function calls to be made across files.

3
  • 3
    Module.exports IS the mechanism to allow function reuse across files. If your objective is to reuse browser based libraries in node.js you can easily modify them to conditionally use module.exports so that they can be used in both node.js and the browser. Commented Nov 30, 2013 at 6:06
  • why do you not want to use module.exports?? Commented Nov 30, 2013 at 6:34
  • 1
    You can make things global, but module.exports is far easier and better. Commented Nov 30, 2013 at 7:02

1 Answer 1

1

Nope

Sorry to let you down, but you have to use module.exports

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.