Repository: react-static/react-static

Issue #1474: Problems with basePath
Created: 2020-07-16T13:13:37Z
I think I have found a problem with the basePath setting in both the basic and typescript sample projects
These are hosted at
http://bendigouniathsclub.org.au/rs-basic/about/
http://bendigouniathsclub.org.au/rs-ts/about/
The nav links look OK using prettier in the dist folders
<a href="/rs-basic/blog">Blog</a>
<a href="/rs-ts/blog">Blog</a>
you on clicking the window.locaton changes though  the basePath  is unset and the <div id="root"></div> is cleared but no new content appears.
I used the react-static create and choose basic in one project and typescript in another
For basic I have this diff
~/projects/rs-basic is 📦 ⚠ via ⬢ v12.16.3 at ☸️  minikube 
➜ diff ../react-static/packages/react-static/templates/basic/static.config.js static.config.js 
--- ../react-static/packages/react-static/templates/basic/static.config.js	2020-07-07 22:27:03.206228677 +1000
+++ static.config.js	2020-07-16 22:20:12.301112552 +1000
@@ -2,6 +2,7 @@
 import axios from 'axios'
 
 export default {
+  basePath:'rs-basic',
   getRoutes: async () => {
     const { data: posts } = await axios.get(
       'https://jsonplaceholder.typicode.com/posts'

And for typescript I have
~/projects/rs-ts is 📦 ⚠ via ⬢ v12.16.3 at ☸️  minikube 
➜ diff  ../react-static/packages/react-static/templates/typescript/static.config.js static.config.js
--- ../react-static/packages/react-static/templates/typescript/static.config.js	2020-07-07 22:27:03.206228677 +1000
+++ static.config.js	2020-07-16 22:27:49.748280569 +1000
@@ -5,6 +5,7 @@
 // Typescript support in static.config.js is not yet supported, but is coming in a future update!
 
 export default {
+  basePath:'rs-ts',
   entry: path.join(__dirname, 'src', 'index.tsx'),
   getRoutes: async () => {
     const { data: posts } /* :{ data: Post[] } */ = await axios.get(

Also the links on the respective blog posts look a though the basePath is not used.
 react-static -v                                                                             
7.4.2
node -v
v12.16.3
yarn -v
1.22.4

Apologies for not submittng a PR but perhaps I am doing something wrong, or not reading the instructions properly

Duplicate issue #1499: ChunkLoadError and `basePath` not being recognized
Created: 2020-09-04T02:19:49Z
There are several bugs and they may or may not be related:


For some reason I'm getting a lot of Uncaught (in promise) ChunkLoadError: Loading chunk 0 failed. type of errors with my build. These could be webpack related (though I'm not sure how to approach it), but I'm not entirely sure. It's bizarre, since the website begins to load correctly at first, but then something happens to cause an error.


Also, when I click through any link it seems that react-static does not seem to add the basePath onto my siteRoot that I've declared in my static.config.js,
i.e. instead of a link directing to:
https://yukon-literacy-coalition.github.io/ylc_website/about
it will instead direct to:
https://yukon-literacy-coalition.github.io/about


Please see the (broken) version of my site at https://yukon-literacy-coalition.github.io/ylc_website/
There are lots of errors in the console.
The related repo is here: https://github.com/Yukon-Literacy-Coalition/ylc_website/tree/gh-pages
And the parent repo (not just the gh-pages/build repo) is here: https://github.com/Yukon-Literacy-Coalition/ylc_website
Reporting a bug?
As far as I know, yes.
Environment

  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
    Memory: 85.43 MB / 8.00 GB
    Shell: 5.0.11 - /usr/local/bin/bash
  Binaries:
    Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v10.15.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 85.0.4183.83
    Firefox: 76.0.1
    Firefox Developer Edition: 65.0
    Safari: 13.1.2
  npmPackages:
    react: ^16.13.1 => 16.13.1
    react-dom: ^16.13.1 => 16.13.1
    react-elastic-carousel: ^0.6.6 => 0.6.6
    react-markdown: ^4.3.1 => 4.3.1
    react-moment: ^0.9.7 => 0.9.7
    react-multi-carousel: ^2.5.5 => 2.5.5
    react-router: ^5.2.0 => 5.2.0
    react-router-dom: ^5.2.0 => 5.2.0
    react-scroll: ^1.7.16 => 1.7.16
    react-static: ^7.2.0 => 7.4.0
    react-static-plugin-emotion: ^7.2.2 => 7.2.2
    react-static-plugin-favicons: ^2.0.0 => 2.0.0
    react-static-plugin-reach-router: ^7.2.0 => 7.4.0
    react-static-plugin-react-router: ^7.4.0 => 7.4.0
    react-static-plugin-sitemap: ^7.2.0 => 7.4.0
    react-static-plugin-source-filesystem: ^7.2.0 => 7.4.0
    react-static-plugin-styled-components: ^7.3.0 => 7.3.0
    react-text-loop: ^2.3.0 => 2.3.0
  npmGlobalPackages:
    react-static: 7.4.0


It should be noted that I'm also NetlifyCMS as a static route (though I don't imagine that should be an issue.
Steps to Reproduce the problem

You would need to build the project from: https://github.com/Yukon-Literacy-Coalition/ylc_website and then put it on a github page.
It seems easier to simply read the console on my current github page at https://yukon-literacy-coalition.github.io/ylc_website/

Expected Behavior
I'm imagining the website should just load.
Reproducible Demo
Please see (broken) site and the console error statements at: https://yukon-literacy-coalition.github.io/ylc_website/
The related repo is here: https://github.com/Yukon-Literacy-Coalition/ylc_website/tree/gh-pages
And the parent repo (not just the gh-pages/build repo) is here: https://github.com/Yukon-Literacy-Coalition/ylc_website

Closing comment (2020-09-06T01:19:53Z): Is this not the same as #1474 ?