Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 907 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 907 Bytes

@malobre/vite-plugin-pages

Enhanced MPA DX:

  • in dev mode, rebase requests to src/pages if the requested file exists there,
  • in build mode, treat all files in src/pages as inputs and rebase them to your project root.

Usage

  1. Install npm install --save-dev @malobre/vite-plugin-pages
  2. Add plugin to your vite config
    import { defineConfig } from 'vite'
    import pages from '@malobre/vite-plugin-pages'
    
    export default defineConfig({
      plugins: [pages()],
    })

Configuration

type Config = {
  // Where your pages are stored, defaults to `src/pages`.
  // Relative to vite's project root: https://vitejs.dev/guide/#index-html-and-project-root
  dir: string;
};

e.g:

import { defineConfig } from 'vite'
import pages from '@malobre/vite-plugin-pages'

export default defineConfig({
  plugins: [pages({
    dir: "other/dir"
  })],
})