require.dist
v0.1.1
Published
require.dist =============
Downloads
60
Readme
require.dist
require.dist
provides a mechanism to inline an asset within a module by embedding
the asset itself or a reference to it for on-demand loading at runtime.
Install
npm install require.dist
npm test
Usage
Component.js
exports.name = "Component";
main.js
var ComponentReference = require.dist("./Component.js");
ComponentReference().then(function (Component) {
ASSERT.equal(Component.name, "Component");
});
ComponentReference
will either return the embedded asset or load the asset based
on an embedded reference depending on which mode the source code was built in.
For more examples see ./UseCases
.
Provenance
Original source logic under Free Public License by Christoph Dorn