Skip to content

Commit

Permalink
Merge pull request webpack#15898 from Magin-CC/main
Browse files Browse the repository at this point in the history
Fix error caused by request is an absolute path in Windows
  • Loading branch information
sokra authored Jun 9, 2022
2 parents 36051a5 + b79500c commit e2f1592
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/FileSystemInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
const { create: createResolver } = require("enhanced-resolve");
const nodeModule = require("module");
const asyncLib = require("neo-async");
const { isAbsolute } = require("path");
const AsyncQueue = require("./util/AsyncQueue");
const StackedCacheMap = require("./util/StackedCacheMap");
const createHash = require("./util/createHash");
Expand Down Expand Up @@ -1633,7 +1634,9 @@ class FileSystemInfo {
let request = relative(this.fs, context, childPath);
if (request.endsWith(".js")) request = request.slice(0, -3);
request = request.replace(/\\/g, "/");
if (!request.startsWith("../")) request = `./${request}`;
if (!request.startsWith("../") && !isAbsolute(request)) {
request = `./${request}`;
}
push({
type: RBDT_RESOLVE_CJS_FILE,
context,
Expand Down

0 comments on commit e2f1592

Please sign in to comment.