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

Projects
None yet
2 participants
@sidharthachatterjee
Copy link
Member

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

@sidharthachatterjee sidharthachatterjee requested a review from gatsbyjs/core as a code owner Jan 23, 2019

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

This comment has been minimized.

Copy link
@DSchau

DSchau Jan 23, 2019

Contributor

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?

This comment has been minimized.

Copy link
@sidharthachatterjee

sidharthachatterjee Jan 23, 2019

Author Member

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

left a comment

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

@DSchau DSchau merged commit 549b8ac into master Jan 23, 2019

14 checks passed

Danger All good
Details
ci/circleci: bootstrap Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_development_runtime Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_gatsby-image Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_gatsbygram Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_path-prefix Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_production_runtime Your tests passed on CircleCI!
Details
ci/circleci: integration_tests Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: starters_validate Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node10 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node6 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node8 Your tests passed on CircleCI!
Details
unit_tests_windows Build #20190123.28 succeeded
Details

@DSchau DSchau deleted the fix/ensure-public-path-is-relative branch Jan 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.