hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite
MIT License
1.87k stars 128 forks source link

fix: `exclude` is not working as expected. #344

Closed xieyhn closed 1 year ago

xieyhn commented 1 year ago

Description

For example, my-app is the project I'm developing and its path on disk is /xie/__demo__/my-app/, when I use vite-plugin-pages it won't match any path because the default exclude option has **/__*__/**.

vite.config.ts

import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'

export default defineConfig({
  plugins: [
    Vue(),
    Pages({
      dirs: [
        { dir: 'src/pages', baseRoute: 'pages' }
      ]
    })
  ]
})

So I think the exclude option here should be relative to my dir option, this PR resolve the problem.

Additional context


What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

hannoeru commented 1 year ago

fixed https://github.com/hannoeru/vite-plugin-pages/commit/ef31440d4222672456ca83e6d59f07c4b58d06e1