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
Contributor

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

Choose a reason for hiding this comment

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

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
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

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
Development

Successfully merging this pull request may close these issues.

SVGs not rendering on iOS with "gatsby develop"
2 participants