GoogleChromeLabs / prerender-loader

📰 Painless universal pre-rendering for Webpack.
https://npm.im/prerender-loader
Apache License 2.0
1.9k stars 50 forks source link

Add `documentUrl` option #12

Closed hugmanrique closed 6 years ago

hugmanrique commented 6 years ago

Some libraries such as react-router or reach-router depend on the current window URL (returned by window.location, location.URL...) to determine which route to render.

This PR adds a documentUrl option which is passed to the JSDOM url option which has the following behavior according to their docs:

url sets the value returned by window.location, document.URL, and document.documentURI, and affects things like resolution of relative URLs within the document and the same-origin restrictions and referrer used while fetching subresources. It defaults to "about:blank".

The default value is undefined which will tell JSDOM to use the default about:blank which you cannot change inside the JSDOM instance.

@developit

googlebot commented 6 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
hugmanrique commented 6 years ago

I signed it!

googlebot commented 6 years ago

CLAs look good, thanks!

hugmanrique commented 6 years ago

@developit any updates?

developit commented 6 years ago

Hiya! Sorry about that - this looks great!