1 | ;
|
2 |
|
3 | const Module = require(`module`);
|
4 |
|
5 | const path = require(`path`); // Polyfill Node's `Module.createRequireFromPath` if not present (added in Node v10.12.0)
|
6 |
|
7 |
|
8 | module.exports = Module.createRequire || Module.createRequireFromPath || function (filename) {
|
9 | const mod = new Module(filename, null);
|
10 | mod.filename = filename;
|
11 | mod.paths = Module._nodeModulePaths(path.dirname(filename));
|
12 |
|
13 | mod._compile(`module.exports = require;`, filename);
|
14 |
|
15 | return mod.exports;
|
16 | };
|
17 | //# sourceMappingURL=create-require-from-path.js.map |
\ | No newline at end of file |