inline-require
v0.1.5
Published
Replace require'd files with the files' contents
Downloads
14
Readme
inline-require
Replace require'd files with the files' contents
Inline dependencies from required modules. Can be used as a module using require
or on the CLI.
Install
$ yarn add inline-require
Usage
// my-dependency.js
module.exports = { foo: 'bar' }
// index.js
const myDependency = require('./my-dependency')
// build.js
const inliner = require('inline-require')
inliner('./index.js', (err, data) => {
if (err) { throw err }
console.log(data) // => const myDependency = { foo: 'bar' }
})
CLI
$ node ./inliner ./index.js # prints to stdout