You could just have a common module.
common.js:
Common = {
util: require('util'),
fs: require('fs'),
path: require('path')
};
module.exports = Common;
app.js:
var Common = require('./common.js');
console.log(Common.util.inspect(Common));
More Related Contents:
- Node.js plans to support import/export ES6 (ECMAScript 2015) modules
- Share variables between files in Node.js?
- Importing modules using ES6 syntax and dynamic path [duplicate]
- Uncaught ReferenceError: process is not defined
- Node.js Async/Await module export
- What do “module.exports” and “exports.methods” mean in NodeJS / Express?
- How to use npm modules in browser? is possible to use them even in local (PC)?
- Node JS fs module inside browser
- JavaScript binding of global result is undefined [closed]
- How do I get started with Node.js [closed]
- map function for objects (instead of arrays)
- Node JS Promise.all and forEach
- Missing credentials for “PLAIN” nodemailer
- how to set socket.io origins to restrict connections to one url
- How can I set response header on express.js assets
- Angular 2 – How to pass URL parameters?
- then() callback firing before promise is resolved in node.js [duplicate]
- Scrape web pages in real time with Node.js
- Javascript console.log(object) vs. concatenating string
- Webpack Express Cannot Resolve Module ‘fs’, Request Dependency is Expression
- Encrypt string in PHP and decrypt in Node.js
- Node.js request CERT_HAS_EXPIRED
- Mongoose: Find, modify, save
- Iterate over object keys in node.js
- configure node express to serve static bower_components?
- Accessing line number in V8 JavaScript (Chrome & Node.js)
- how to use jQuery installed with npm in Express app?
- Visual Studio Code Intellisense not working for Javascript
- Socket.io – Manual reconnect after client-side disconnect
- JavaScript EventSource SSE not firing in browser