hannoeru / vite-plugin-pages

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

exclude not work when file change #391

Open liuyang0826 opened 1 year ago

liuyang0826 commented 1 year ago

Describe the bug

https://github.com/hannoeru/vite-plugin-pages/blob/main/src/utils.ts#L38 isTarget not validate exclude options

Reproduction

https://github.com/hannoeru/vite-plugin-pages/blob/main/src/utils.ts#L38

System Info

System:
  OS: Windows 10 10.0.22621
  CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-11390H @ 3.40GHz
  Memory: 4.61 GB / 15.74 GB
Binaries:
  Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
  npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Spartan (44.22621.1413.0), Chromium (111.0.1661.44)
  Internet Explorer: 11.0.22621.1

Used Package Manager

npm

Validations

xianghongai commented 9 months ago
export default defineConfig(({ mode }) => {
  return {

    plugins: [

      // https://www.npmjs.com/package/vite-plugin-pages
      Pages({
        dirs: 'src/views',
        exclude: ['**/{_components_,_services_,_configs_,constants_,_utils_,_styles_}/**'],
      }),

    ],
  };
});

When I create a new directory that matches the exclude rule, the corresponding route will be generated, which is not as expected.

{
    "name": "news-_configs_",
    "path": "/news/_configs_",
    "props": true
}
whxmm0608 commented 9 months ago

It's happend to me too.any solutions?