Problems with basePath
See original GitHub issueI 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
For anyone playing along at home, you can add this to your static.config.js so you can experiment with
yarn build && yarn serve
and not have to deploy…That did not work. See https://github.com/reach/router/issues/78 They are grappling. There is a work around in the above…