hannoeru / vite-plugin-pages

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

fix: handle extensions like `page.tsx` #421

Closed kota65535 closed 1 year ago

kota65535 commented 1 year ago

Description

fixes #319

Additional context


What is the purpose of this pull request?

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

kota65535 commented 1 year ago

@hannoeru Thank you for running CI. Hmm, I have no idea why some workflows fail. Simply unstable for now?

hannoeru commented 1 year ago

@kota65535 Yes, e2e test are unstable now, just ignore it.

hannoeru commented 1 year ago

@kota65535

Currently we have two options that can filter pages file, one is filePattern, and the other one is extensions which generate default filePattern under the hood.

Maybe we should find a more simple and consistent way to defined these two options.

kota65535 commented 1 year ago

@hannoeru At first, I tried considering the rest of the string as the extension after the first dot, but then I realized that it cannot handle file names like v1.2.pages.tsx to be mapped to the path /v1.2. So I think both of two options filePattern and extensions are needed to define the mapping from file names to paths correctly. Any ideas to simplify it?

kota65535 commented 1 year ago

@hannoeru Fixed, please check.

kota65535 commented 1 year ago

@hannoeru Oh sorry, I didn't make sure to work properly after fixing it, thanks. I've added the change you suggested.