A Rsbuild plugin designed to collect pages and generate a Multi-Page Application (MPA).
Note: This plugin is currently under development, and its API may be subject to change.
Install the plugin via npm:
npm install rsbuild-plugin-rempa --save-dev
Add the plugin to your rsbuild
configuration file:
// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginRempa } from 'rsbuild-plugin-rempa';
export default defineConfig({
plugins: [pluginReact(), pluginRempa()],
});
-
template
(string): Specifies the HTML template file to use for the generated pages. Defaults to the Rsbuild default template. -
layout
(string): Defines the default layout path for the entry page. Defaults to<>{children}</>
.
The plugin automatically generates entry files for each page based on the config.json
files located in the src/pages
directory.
Example config.json
:
{
"title": "Index Page",
"layout": "./layout.tsx"
}
Supported config.json
options include:
-
template
: Path to the template file. -
layout
: Path to the page layout. -
title
: Title of the page. -
mountElementId
: The ID of the DOM node where the page will be mounted. Defaults toroot
. - Additional properties will be passed to the template as
templateParameters
.
For a working example, see the playground.
MIT