[Bug] Siteroot and basePath don't work with routes
See original GitHub issueEnvironment
- System: OS: macOS Mojave 10.14.3 CPU: (8) x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Memory: 2.77 GB / 16.00 GB Shell: 3.2.57 - /bin/bash
- Binaries: Node: 11.12.0 - /usr/local/bin/node Yarn: 1.15.2 - /usr/local/bin/yarn
- Browsers: Chrome: 73.0.3683.103
- npmPackages: react: ^16.8.2 => 16.8.6 react-color: ^2.17.0 => 2.17.0 react-dom: ^16.8.2 => 16.8.6 react-static: ^7.0.0 => 7.0.5 react-static-plugin-reach-router: ^7.0.0 => 7.0.0 react-static-plugin-sitemap: ^7.0.0 => 7.0.0 react-static-plugin-source-filesystem: ^7.0.0 => 7.0.0 npmGlobalPackages: react-static: 7.0.7
Steps to Reproduce the problem
- react-static create
with “basic” template
- In static.config.js
import path from "path";
export default {
siteRoot: "http://localhost:3000",
basePath: "dist",
// maxThreads: 1, // Remove this when you start doing any static generation
plugins: [
[
require.resolve("react-static-plugin-source-filesystem"),
{
location: path.resolve("src/pages")
}
],
require.resolve("react-static-plugin-reach-router"),
require.resolve("react-static-plugin-sitemap")
]
};
-
yarn build && serve . -p 3000
-
Go to “http://localhost:3000/dist”
Expected Behavior
Template example should work normally with its routes
Problem
It doesn’t, console show 404 error for loading ressources, path is incorrect.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Rewrites bug when using with basePath and public directory
Bug report Describe the bug Next.js cannot rewrites URL when using ... request not having basePath as its path prefix for public routes....
Read more >Next.js app in subfolder with basePath, how to make home ...
but got an error: The route / rewrites urls outside of the basePath. Please use a destination that starts with `http://` or `https://`...
Read more >Relative and absolute paths, in the file system and on the web ...
If you don't supply the root, it means that your path is relative. ... just build it from the site root - and...
Read more >Router tutorial: tour of heroes - Angular
In this tutorial, you build upon a basic router configuration to explore features such as child routes, route parameters, lazy load NgModules, guard...
Read more >Routes and Endpoints | REST API Handbook
The “route” is wp/v2/posts/123 – The route doesn't include wp-json because wp-json is the base path for the API itself. This route has...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I proposed a fix in PR #1196.
Same here, can be seen on a live site here.
Console output of failed requests:
Links appear to point to the correct page, but then error out when clicked.
And indeed, the template tags appear wrong:
My debugging info: