This is a Vite Plugin for Multi Page Applications.
npm i -D vite-plugin-shiwaforce-mpa
Import the package from the top of your file
import mpa from 'vite-plugin-shiwaforce-mpa';
extend your plugins in the vite.config.js with the mpa()
plugin.
plugins: [
mpa(interceptor = null, serverConfigurations = [], userConfig = {})
],
You can use an interceptor which works before the rewrite rule.
function interceptor(req, res, next) {
// access req res and next variables
}
You can add any express configurations if you import it before, and pass it in as an array.
const cookieParser = require('cookie-parser');
// ...
mpa(interceptor, [cookieParser], {}),