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

Fetch source maps over HTTP #79

Closed
wants to merge 1 commit into from

Conversation

shishkin
Copy link

I was running into problems with source map URLs pointing to remote https:// resources. Same problem as #77.

This fix seems to solve my problem by fetching the remote source maps for future bundling. Ideally I would prefer source-map-loader to ignore HTTP URLs and pass them verbatim for the browser to fetch remote source maps when needed. However I couldn't figure out how to do that.

Any feedback is welcome!

@@ -68,6 +69,20 @@ module.exports = function(input, inputMap) {
function untouched() {
callback(null, input, inputMap);
}
function fetchHttp(source, callback) {
http.get(source, function (resp) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built-in http.get() is very bare-bones, e.g. doesn't follow redirects. Should probably use some higher-level library.
Also, does this need caching? Or is there already a cache on another layer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use got

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built-in http.get() is very bare-bones, e.g. doesn't follow redirects. Should probably use some higher-level library.
Also, does this need caching? Or is there already a cache on another layer?

I understand. Any considerations about bringing in a new dependency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use got

I'll try. Thanks for recommendation.

@Atry
Copy link

Atry commented Mar 19, 2019

This PR does not handle HTTP redirection.

If the original source map to https://github.com/ThoughtWorksInc/Binding.scala/raw/78443c86e5046bd1e13f1504fa9280e668d55eb9/Binding/src/main/scala/com/thoughtworks/binding/Binding.scala, this PR will create a file with the following content:

<html><body>You are being <a href="https://raw.githubusercontent.com/ThoughtWorksInc/Binding.scala/78443c86e5046bd1e13f1504fa9280e668d55eb9/Binding/src/main/scala/com/thoughtworks/binding/Binding.scala">redirected</a>.</body></html>


// WEBPACK FOOTER //
// https://github.com/ThoughtWorksInc/Binding.scala/raw/78443c86e5046bd1e13f1504fa9280e668d55eb9/Binding/src/main/scala/com/thoughtworks/binding/Binding.scala

This was referenced May 23, 2020
@alexander-akait
Copy link
Member

Close in favor #113, will be implemented for 1.1.0 version, anyway sorry for delay and thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants