@yme/lay-router
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

@yme/lay-router

generate page routes

example

// vite.config.ts
import layRouter from '@yme/lay-router/vite';

export default defineConfig({
  plugins: [
    // ...
    // define in vite
    layRouter()
    // ...
  ]
});

And run the development server

pnpm dev

directories

src
- pages
  - users
    - page.tsx
  - dashboard
    - analytics
      - page.tsx
- layouts
  - root
    - layout.tsx
  - basic
    - layout.tsx

Then you can see the generated routes in src/pages/index.ts and src/layouts/index.ts

// src/pages/index.ts
export const pages = [
  ...
  {
    slug: '/foo/bar/zoo',
    path: 'foo/bar/zoo',
    component: __component_1__
  },
  ...
];

// src/layouts/index.ts
export const layouts = {
  root,
  ...
};

Recommended for use with @yme/lay-router-react

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @yme/lay-router

Weekly Downloads

0

Version

0.6.0

License

MIT

Unpacked Size

70.3 kB

Total Files

14

Last publish

Collaborators

  • minosss