Comments (5)
What are the contents of window.location
in this environment when you start the page? We use that to determine the initial location and start matching paths.
react-router/packages/router/history.ts
Line 367 in a04ae6b
from react-router.
@timdorr Seems like the path with /dist/index
is causing some issue. I'm still troubleshooting and will comeback with more details.
// this one is not working. Throwing an error in the console the error points to some code in the console.
{
path: "dist/index",
element: <Home />,
}
// This one is working as expected.
{
path: "/dist/home",
element: <Home />,
}
```
from react-router.
@timdorr I just changed the path value to /dist/home
and tried again. This time it logged an error
Uncaught Error: Minified React error #299; visit https://reactjs.org/docs/error-decoder.html?invariant=299
The error further points to the below code snippet in the bundle:
qe.createRoot = function(e, t) {
if (!Ka(e))
throw Error(T(299)); // throws error here
var n = !1
, r = ""
, l = vp;
return t != null && (t.unstable_strictMode === !0 && (n = !0),
t.identifierPrefix !== void 0 && (r = t.identifierPrefix),
t.onRecoverableError !== void 0 && (l = t.onRecoverableError)),
t = Va(e, 1, !1, null, null, n, !1, r, l),
e[zt] = t.current,
ul(e.nodeType === 8 ? e.parentNode : e),
new Qa(t)
}
const K0 = N0([{
path: "/dist/home",
element: ie.jsx(V0, {})
}, {
path: "/dist/about",
element: ie.jsx(H0, {})
}, {
path: "/dist/contact",
element: ie.jsx(Q0, {})
}]);
Gi.createRoot(document.getElementById("root")).render(ie.jsx(na.StrictMode, {
children: ie.jsx(dg, {
store: Qy,
children: ie.jsx(U0, {
router: K0
})
})
}));
from react-router.
That's an error caused by document.getElementById("root")
not finding an element. That doesn't have anything to do with React Router.
My suspicion is that you need to find the right combination of basename and start_url
to make this load correctly. This isn't a bug with React Router, just a matter of configuring your application correctly.
from react-router.
@timdorr Totally agree. We're using a simple server for testing. That might be causing the issue.
I would like to use the start_url
as dist/home.html
. in this case what should be the basename? Because having dist/home.hmtl
as the start_url
the server might be trying to serve html file instead of a react component.
from react-router.
Related Issues (20)
- [Bug]: useBlocker is not working HOT 5
- [Bug]: Cannot navigate in windows production HOT 2
- [Bug]: Unable to Pass State Using useNavigate When Navigating Back to Previous Route HOT 1
- [Bug]: Navigation don't work with createBrowserRouter sometimes HOT 2
- [Bug]: lazy loaded module error in nested router is catched only by the parent route with the * wildcard, not by the `errorElement` in the nested router HOT 2
- [Bug]: `fetcher.data` is define when submitting via `fetcher.submit` but is undefined when submitting a `fetcher.Form` HOT 3
- [Bug]: Navigation from '//' pathname does not work; path '*' is not matching the '//' page HOT 1
- [Bug]: Getting "A router only supports one blocker at a time" warning when running your navigation-blocking example HOT 2
- [Bug]: `setSearchParams` do not provide the latest queryString passed as argument to `navigate` HOT 3
- [Bug]: React Router swallows render error HOT 1
- [Bug]: useBlocker in createBrowserRouter is not working
- [Bug]: useLocation value being null when 0 is set as the state value of useNavigate
- [Docs]: for useSearchParams, functional updates should be explained in more detail HOT 3
- [Bug]: React router doesn't handle 'content://' URLs
- [Bug]: the state is not destroyed in the useFetcher hook with key parametr
- [Bug]: Outlet component remounts in production when changing state above it HOT 2
- [Bug]: loader of Route running even if Route / Router is not rendered HOT 2
- [Docs]: Docs for shouldRevalidate make it sound like it is only for opting out
- [Bug]: `useLocation` out of sync with `history.location`, leads to potential renders of unmatched `Route`s
- [Bug]: useLoaderData triggers component re rendering even if the route remains unchanged HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router.