Run the following command to install the correct version of Rasengan.js
bashpnpm add rasengan@~1.2.0
GETTING STARTED
To update to the latest version of Rasengan.js, you just have to run the following command:
bashpnpm add rasengan@latest
To update to the latest beta version of Rasengan.js, you just have to run the following command:
bashpnpm add rasengan@beta
If you want to improve the performance of your application — especially as it grows in size — upgrading to version 1.2.x is a great choice.
This version introduces two major features:
Routes are now loaded on demand, based on the page the user is visiting. This means your app only loads what it needs, when it needs it — which helps reduce initial load time and makes navigation feel faster.
Everything is handled automatically, there is no option to opt out this feature.
You can now generate static HTML files for your pages ahead of time. This improves performance, SEO, and allows your site to be served extremely fast, without waiting for server responses or client-side rendering.
The configuration is simple, inside the rasengan.config.js file, you just have to enable the prerender option.
jsimport { defineConfig } from 'rasengan'; import { rasengan } from 'rasengan/plugin'; export default defineConfig({ prerender: true, vite: { plugins: [rasengan()], }, });
This is the minimal configuration, it will enable the prerender globally into your application. If you prefer, you can select what you really want to prerender.
jsimport { defineConfig } from 'rasengan'; import { rasengan } from 'rasengan/plugin'; export default defineConfig({ prerender: { routes: ['/', 'blog/**'], }, vite: { plugins: [rasengan()], }, });
This approach is ideal for hybrid applications, where:
So, to upgrade you have to follow the following steps:
Run the following command to install the correct version of Rasengan.js
bashpnpm add rasengan@~1.2.0
Get off the AppRouter instance from the main.tsx, because it's not longer important there.
Before
tsximport '@/styles/index.css'; import { type AppProps } from 'rasengan'; import AppRouter from '@/app/app.router'; export default function App({ Component, children }: AppProps) { return <Component router={AppRouter}>{children}</Component>; }
After
tsximport '@/styles/index.css'; import { type AppProps } from 'rasengan'; export default function App({ Component, children }: AppProps) { return <Component>{children}</Component>; }
Now import the AppRouter instance into the index.ts file
Before
tsimport { renderApp } from 'rasengan/client'; import App from './main'; renderApp(App, { reactStrictMode: true });
After
tsimport { renderApp } from 'rasengan/client'; import App from './main'; import AppRouter from '@/app/app.router'; renderApp(App, AppRouter, { reactStrictMode: true });
Then run the dev command to start the local server
bashpnpm run dev