Skip to content

Commit

Permalink
refactor!: isUrlRequest was removed, webpack since version v5 suppo…
Browse files Browse the repository at this point in the history
…rts absolute data URI/URLs/paths, anyway if you don't want to handle absolute URLs you can handle it on `loader` side using `/^[a-z][a-z0-9+.-]*:/i.test(url)` regexp
  • Loading branch information
alexander-akait committed Oct 20, 2021
1 parent d19e92f commit 973c82a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 236 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,8 @@ loaderUtils.stringifyRequest(this, "\\\\network-drive\\test.js");

Converts some resource URL to a webpack module request.

> i Before call `urlToRequest` you need call `isUrlRequest` to ensure it is requestable url
```javascript
const url = "path/to/module.js";

if (loaderUtils.isUrlRequest(url)) {
// Logic for requestable url
const request = loaderUtils.urlToRequest(url);
} else {
// Logic for not requestable url
}
const request = loaderUtils.urlToRequest(url);
```

Simple example:
Expand Down
2 changes: 0 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

const parseQuery = require("./parseQuery");
const stringifyRequest = require("./stringifyRequest");
const isUrlRequest = require("./isUrlRequest");
const urlToRequest = require("./urlToRequest");
const parseString = require("./parseString");
const getHashDigest = require("./getHashDigest");
const interpolateName = require("./interpolateName");

exports.parseQuery = parseQuery;
exports.stringifyRequest = stringifyRequest;
exports.isUrlRequest = isUrlRequest;
exports.urlToRequest = urlToRequest;
exports.parseString = parseString;
exports.getHashDigest = getHashDigest;
Expand Down
31 changes: 0 additions & 31 deletions lib/isUrlRequest.js

This file was deleted.

193 changes: 0 additions & 193 deletions test/isUrlRequest.test.js

This file was deleted.

0 comments on commit 973c82a

Please sign in to comment.