Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: PR #79 #135

Merged
merged 1 commit into from
Dec 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ 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
}
```

Simple example:

```javascript
const url = "path/to/module.js";
const request = loaderUtils.urlToRequest(url); // "./path/to/module.js"
Expand Down
3 changes: 0 additions & 3 deletions lib/urlToRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ function urlToRequest(url, root) {
'.'
);
}
} else if (/^(?:https?:)?\/\//.test(url)) {
// Preserve http and https urls
request = url;
} else if (/^\.\.?\//.test(url)) {
// A relative url stays
request = url;
Expand Down
3 changes: 0 additions & 3 deletions test/urlToRequest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ ExpectedError.prototype.matches = function(err) {
describe('urlToRequest()', () => {
[
// without root
[['//google.com'], '//google.com', 'should handle scheme-agnostic urls'],
[['http://google.com'], 'http://google.com', 'should handle http urls'],
[['https://google.com'], 'https://google.com', 'should handle https urls'],
[
['path/to/thing'],
'./path/to/thing',
Expand Down