1 | 'use strict';
|
2 |
|
3 | exports.__esModule = true;
|
4 |
|
5 | const Module = require('module');
|
6 | const path = require('path');
|
7 |
|
8 |
|
9 |
|
10 | function createModule(filename) {
|
11 | const mod = new Module(filename);
|
12 | mod.filename = filename;
|
13 |
|
14 | mod.paths = Module._nodeModulePaths(path.dirname(filename));
|
15 | return mod;
|
16 | }
|
17 |
|
18 |
|
19 | exports.default = function moduleRequire(p) {
|
20 | try {
|
21 |
|
22 | const eslintPath = require.resolve('eslint');
|
23 | const eslintModule = createModule(eslintPath);
|
24 |
|
25 | return require(Module._resolveFilename(p, eslintModule));
|
26 | } catch (err) { }
|
27 |
|
28 | try {
|
29 |
|
30 |
|
31 | return require.main.require(p);
|
32 | } catch (err) { }
|
33 |
|
34 |
|
35 | return require(p);
|
36 | };
|