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

fix(gatsby): Ensure publicPath is always relative for gatsby develop #11227

Merged
merged 1 commit into from Jan 23, 2019

Conversation

@sidharthachatterjee
Copy link
Member

@sidharthachatterjee sidharthachatterjee commented Jan 23, 2019

In gatsby develop we were setting publicPath for webpack-dev-server to an absolute url constructed from the program host, port and protocol

This is unnecessary and causes HMR and static links to break when viewed on a separate device over a network like in this screenshot below
screenshot 2019-01-23 19 04 21
This pull request fixes this by making the publicPath always relative

Fixes #11219 and #5801

`${program.ssl ? `https` : `http`}://${
program.host
}:${webpackPort}/`,
publicPath: process.env.GATSBY_WEBPACK_PUBLICPATH || `/`,
Copy link
Contributor

@DSchau DSchau Jan 23, 2019

Wouldn't we still want to handle the ssl stuff? Seems like this would be a breaking change for that behavior.

If nothing else--would you be able to validate this hasn't broken that behavior?

Copy link
Member Author

@sidharthachatterjee sidharthachatterjee Jan 23, 2019

Just tested, works fine!

Keep in mind that the automatic certificates issued with the --https flag are explicitly issued to localhost and will only be accepted there. Using it together with the --host option will likely result in browser warnings.

This behaviour documented in https://www.gatsbyjs.org/docs/local-https/ remains the same

DSchau
DSchau approved these changes Jan 23, 2019
Copy link
Contributor

@DSchau DSchau left a comment

This did seem weird--so yeah, let's try this out. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants