Skip to content

Commit a8f5447

Browse files
fix: handling \ character
1 parent 497a2a5 commit a8f5447

File tree

6 files changed

+321
-51
lines changed

6 files changed

+321
-51
lines changed

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,15 @@ const moduleRequestRegex = /^[^?]*~/;
378378
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
379379

380380
export function requestify(url) {
381-
if (matchNativeWin32Path.test(url) || url[0] === '/') {
381+
if (matchNativeWin32Path.test(url) || url[0] === '/' || url[0] === '\\') {
382382
return url;
383383
}
384384

385385
if (/^file:/i.test(url)) {
386386
return url;
387387
}
388388

389-
if (/^\.\.?\//.test(url)) {
389+
if (/(^\.\.?\/)|(^\.\.?\\)/.test(url)) {
390390
return url;
391391
}
392392

test/__snapshots__/esModule-option.test.js.snap

Lines changed: 45 additions & 6 deletions
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

Lines changed: 15 additions & 2 deletions
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

Lines changed: 75 additions & 12 deletions
Large diffs are not rendered by default.

test/__snapshots__/sources-option.test.js.snap

Lines changed: 178 additions & 28 deletions
Large diffs are not rendered by default.

test/fixtures/simple.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,4 +436,9 @@ <h2>An Ordered HTML List</h2>
436436

437437
<meta itemprop="a" content="./image.png" />
438438
<meta itemprop="b" content="./image.png" />
439-
<meta itemprop=" " content="./image.png" />
439+
<meta itemprop=" " content="./image.png" />
440+
441+
<img src='.\nested\image3.png' />
442+
<img src='\nested\image3.png' />
443+
<img src='/nested\image3.png' />
444+
<img src='nested\image3.png' />

0 commit comments

Comments
 (0)