-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby new
: url-parse URL leaking into global scope
#10816
Comments
Hmm... so I can't really replicate this! Are you able to provide a reproduction? As best as I can tell, it does look like url-parse is a dependency of webpack-dev-server, but I wouldn't think that would make its way into your code. ➜ yarn why url-parse
yarn why v1.12.3
[1/4] 🤔 Why do we have the module "url-parse"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
- "gatsby#react-dev-utils#sockjs-client" depends on it
- Hoisted from "gatsby#react-dev-utils#sockjs-client#url-parse"
- Hoisted from "gatsby#webpack-dev-server#sockjs-client#url-parse"
- Hoisted from "gatsby#react-dev-utils#sockjs-client#eventsource#original#url-parse"
info Disk size without dependencies: "64KB"
info Disk size with unique dependencies: "108KB"
info Disk size with transitive dependencies: "108KB"
info Number of shared dependencies: 2
✨ Done in 0.60s. Additionally, here's a screenshot of the (working?) example you provided. Please let me know if I missed anything--but a reproduction on your end would be very helpful here! |
@DSchau |
@ukch yeah - I still unfortunately can't reproduce it from my local environment, but I think there are other issues regardless, specifically:
I've fixed the example in this repo and you can see the hosted version here Going to close this as answered, but please feel free to re-open if I can help further. Also a note here, that I do think this can be quite confusing. We've attempted to converge on the development/build lifecycles here, so more work to do for sure--although I'm not sure there's much we can do here to guard against this! |
The issue of URL not existing in the Node.JS environment is a separate issue which I am fixing in my real project by use of
That is a misdiagnosis of the issue. As I mentioned previously, this is an issue which has only recently started occurring, specifically causing the browser-default URL implementation to be replaced by Upon further testing of the issue, I can confirm that the issue is present in Firefox but not Chrome, which (assuming you are a Chrome user) explains why you were unable to reproduce it. Please can you re-open the issue as I am not able to? |
This actually seems supported by the info you provide--although it does seem to be browser vs. node as I asserted. You mention that it works in Firefox (but not Chrome) on your Linux environment. That behavior is not reproducible on my OS (Mac OS Mojave 10.14.2), and I tested in Firefox, Chrome, and Safari. All fail on the build step (as you note), but all worked correctly in the local development server with the query string.
These non-gatsby sites aren't server-side-rendered though, correct? Would it be possible to create a more real-world reproduction (e.g. using the universal-url implementation) that demonstrates the issue in |
It's very strange that you can't reproduce the issue at all. Are you using the provided
Correct. But as mentioned in the original bug report,
On a normal site (e.g. Google or Github):
On our example Gatsby site, during developer mode:
/**
* The actual URL instance. Instead of returning an object we've opted-in to
* create an actual constructor as it's much more memory efficient and
* faster and it pleases my OCD. Searching Google for that string shows us that it is from the |
I'm on Firefox 64 by the way, just in case that matters. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
@gatsbot please re-open this issue. I am still awaiting response from @DSchau to my last set of comments. |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Description
I work a lot with the
URL
interface. Recently, I noticed my site was not working properly after some updates, and I have narrowed it down to the following:url-parse
module provides a replacementURL
with a slightly different interface to the official whatwg version.url-parse
version in the global object (a.k.a.window
)Steps to reproduce
gatsby new
src/pages/index.js
with the following:gatsby develop
Expected result
The string
http://example.com/foo.html?bar=baz
should be displayed inside an h1.c.f. what happens when you paste the following code directly into JSBin:
Actual result
The displayed URL is missing the search string. Inspecting the
URL
function from the browser devtools shows theurl-parse
version instead of the browser-built-in version.Environment
The text was updated successfully, but these errors were encountered: