Skip to content

Deploying React App to Github Pages (gh-pages) #2419

Discussion options

You must be logged in to vote

TL;DR for people looking for a solution

  • set buildOptions.metaUrlPath to something without an underscore (e.g. dist)
  • set optimize.bundle to true to create a single .js file, hopefully without underscores
  • manually change the index.html file to set some absolute URLs: <script type="module" src="https://joepio.github.io/atomic-react/dist/index.js"></script>

TL;DR for Snowpack maintaners

  • GithubPages hosts sites on paths (which break relative URLs), and ignores _underscores (which break the _snowpack folder and some other files).
  • The baseUrl setting does not work (as far as I can tell)

Longer version

Had a similar problem with my repo. My issue was that that the script tag in index.html lin…

Replies: 6 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@AsaAyers
Comment options

@Devorein
Comment options

Answer selected by melissamcewen
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants