0.0.10 • Published 2 years ago

vite-plugin-react-router-dom v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-plugin-react-router-dom

A simple plugin intends to simplify code structure when using react-router with vite. Supports dynamic imports.

Before:

import { createBrowserRouter } from 'react-router-dom';
import { lazy } from 'react';
import App from './App';
const Demo = lazy(() => import('./Demo'));

const router = createBrowserRouter(
  [
    {
      path: '/',
      element: <App />,
    },
    {
      path: '/demo',
      element: <Demo />,
    },
  ],
  {},
);

export default router;

After:

// router.config.js
export default {
  '/': './App',
  '/demo': {
    src: './Demo',
    dynamic: true,
  },
};

See example/router.config.js for more usages.

Install

npm install --save-dev vite-plugin-react-router-dom
0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago