Duplicates
Latest version
Summary 💡
currently, FileRoutes lazy-loades all routes by default which is sometimes undesired.
Adding a sync option (that is false by default) or a async option to enable lazy loading (that is false by default) to FileRoutes to disable lazy loading all routes will fix that.
even better, this could be decided for each route separately.
Examples 🌈
a workaround is using custom <Route />s instead of using <FileRoutes />:
import { MetaProvider, Title } from "@solidjs/meta";
import { Route, Router } from "@solidjs/router";
import { Suspense } from "solid-js";
import Home from "./routes";
import About from "./routes/about";
import { get } from "./lib/api";
import NotFound from "./routes/[...404]";
export default function App() {
return (
<Router
root={(props) => (
<MetaProvider>
<Title>SolidStart - Basic</Title>
<a href="/">Index</a>
<a href="/about">About</a>
<Suspense>{props.children}</Suspense>
</MetaProvider>
)}
>
<Route path="/" component={Home} />
<Route load={() => get()} path="/about" component={About} />
<Route path="*404" component={NotFound} />
</Router>
);
}
Motivation 🔦
No response
Duplicates
Latest version
Summary 💡
currently,
FileRouteslazy-loades all routes by default which is sometimes undesired.Adding a
syncoption (that isfalseby default) or aasyncoption to enable lazy loading (that isfalseby default) toFileRoutesto disable lazy loading all routes will fix that.even better, this could be decided for each route separately.
Examples 🌈
a workaround is using custom
<Route />s instead of using<FileRoutes />:Motivation 🔦
No response