Monday, 17 April 2017

How do you organize js files so that you can require from them within one npm package?

I have a couple of nodejs files I want to group together in one folder, because they fit together logically.

Say they're called a.js, b.js, c.js

In my app, I have code that imports from these files like:

require('a') require('b') require('c').

How do I package those files together so that I don't have to change my individual requires? Is there an option in package.json file so that I can make those files exportable on a global scale without relying on the directory that contains those files?



via checks

No comments:

Post a Comment