update to resolved Request

This commit is contained in:
Philipp Kunz 2017-07-30 15:53:58 +02:00
parent b5afc4d525
commit 4888d046ed
2 changed files with 8 additions and 5 deletions

8
dist/index.js vendored
View File

@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
let Module = require('module');
const path = require("path");
const sourceMap = require("source-map-support");
const through2 = require("through2");
sourceMap.install({
@ -39,8 +40,9 @@ Module._extensions['.js'] = function (module, filename) {
};
let originalModuleResolve = Module._resolveFilename;
Module._resolveFilename = function (request, parent, isMain) {
let file = cache[request];
let file2 = cache[request + '.js'];
let resolvedRequest = path.resolve(parent.id, request);
let file = cache[resolvedRequest];
let file2 = cache[resolvedRequest + '.js'];
if (file || file2) {
return request;
}
@ -60,4 +62,4 @@ exports.injectFileArray = (fileArray) => __awaiter(this, void 0, void 0, functio
}
return fileArray;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsMEJBQXVCO0FBRXZCLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQTtBQUU5QixnREFBZ0Q7QUFDaEQscUNBQXFDO0FBS3JDLFNBQVMsQ0FBQyxPQUFPLENBQUM7SUFDaEIsWUFBWSxFQUFFLFVBQVUsSUFBSTtRQUMxQixFQUFFLENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ2hCLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFBO1FBQ3hDLENBQUM7UUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENB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RQUNsQixNQUFNLENBQUMsT0FBTyxDQUFBO0lBQ2hCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLFNBQVMsQ0FBQyxDQUFBO0lBQ3JELENBQUM7QUFDSCxDQUFDLENBQUE7QUFFVSxRQUFBLFFBQVEsR0FBRztJQUNwQixNQUFNLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxVQUFVLElBQUksRUFBRSxHQUFHLEVBQUUsRUFBRTtRQUN6QyxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQTtRQUN2QixNQUFNLENBQUMsRUFBRSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQTtJQUN2QixDQUFDLENBQUMsQ0FBQTtBQUNKLENBQUMsQ0FBQTtBQU9VLFFBQUEsZUFBZSxHQUFHLENBQU8sU0FBdUI7SUFDekQsR0FBRyxDQUFDLENBQUMsSUFBSSxVQUFVLElBQUksU0FBUyxDQUFDLENBQUMsQ0FBQztRQUNqQyxLQUFLLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxHQUFHLFVBQVUsQ0FBQTtJQUNyQyxDQUFDO0lBQ0QsTUFBTSxDQUFDLFNBQVMsQ0FBQTtBQUNsQixDQUFDLENBQUEsQ0FBQSJ9

View File

@ -36,8 +36,9 @@ Module._extensions['.js'] = function (module, filename) {
let originalModuleResolve = Module._resolveFilename
Module._resolveFilename = function (request, parent, isMain) {
let file = cache[request]
let file2 = cache[request + '.js']
let resolvedRequest = path.resolve(parent.id, request)
let file = cache[resolvedRequest]
let file2 = cache[resolvedRequest + '.js']
if (file || file2) {
return request
} else {