You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
392 B
JavaScript

5 years ago
'use strict';
module.exports = install;
function install(precompile, ext, extensions) {
ext = ext || '.js';
extensions = extensions || require.extensions;
var oldExtension = extensions[ext];
extensions[ext] = function (module, filename) {
var source = precompile(filename);
if (source) {
module._compile(source, filename);
return;
}
oldExtension(module, filename);
};
}