question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with basePath

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewCreercommented, Jul 30, 2020

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…

export default {
  basePath: "rs-basic",
  //devBasePath: "rs-dev",
  paths: {
    dist: "dist/rs-basic",
  },
  getRoutes: async () => {
1reaction
AndrewCreercommented, Jul 29, 2020

That did not work. See https://github.com/reach/router/issues/78 They are grappling. There is a work around in the above…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect prefetch urls with BasePath · Issue #11959 - GitHub
Bug report Describe the bug Deployed a NextJS app under a basePath and any route change was causing a full page render, so...
Read more >
How to fix Blazor WASM base path problems - elmah.io Blog
This post will show you how to fix a common problem when setting the application base path with Blazor WebAssembly.
Read more >
NextJS v10 Image component fails to serve image when there ...
How I am supposed to define the src property while there is a basePath to be able to serve the images? <Image src="/me.jpg"...
Read more >
Kibana 7.14.1 - server.basePath not working - Users Feedback
Hi,. I have migrated ES & Kibana to version 7.14.1 and installed ROR 1.34. When I try to access Kibana, I get the...
Read more >
Openapi 3.0.x basepath undefined error (#381047) - GitLab
No tasks are currently assigned. Use tasks to break down this issue into smaller parts. Linked items. 0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found