Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle .page.vue extension #101

Closed
stefanprobst opened this issue Dec 1, 2022 · 4 comments
Closed

handle .page.vue extension #101

stefanprobst opened this issue Dec 1, 2022 · 4 comments

Comments

@stefanprobst
Copy link
Contributor

when configuring the vite plugin with a .page.vue extension, the generated route config includes e.g. /index.page for ./src/pages/index.page.vue:

// vite.config.ts
import vue from '@vitejs/plugin-vue'
import router from 'unplugin-vue-router/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    router({ dts: './routes.d.ts', extensions: ['.page.vue'] }),
    vue(),
  ],
})
// snippet from generated routes.d.ts
declare module 'vue-router/auto/routes' {
  export interface RouteNamedMap {
    '/index.page': RouteRecordInfo<
      '/index.page',
      '/index/page',
      Record<never, never>,
      Record<never, never>
    >
  }
}
@posva
Copy link
Owner

posva commented Dec 22, 2022

The . Here has a special meaning and is transformed to a slash

what are you expecting exactly?

@stefanprobst
Copy link
Contributor Author

when i configure a file extension which includes a dot, e.g. extensions: ["page.vue"], i would expect that this dot will be treated as being part of the file extension and not converted to a slash.

i guess this would mean that trimExtension should not simply slice off everything after the last dot, but use the actual configured extensions.

Copy link
Owner

posva commented Dec 22, 2022

I see. What is the idea of having .page.vue exactly? Is it more of a domain-based file organization, something similar to Next.js and SvelteKit conventions?

@posva posva added the enhancement label Dec 22, 2022 — with Volta.net
@stefanprobst
Copy link
Contributor Author

Is it more of a domain-based file organization, something similar to Next.js and SvelteKit conventions?

yep, exactly.

@posva posva closed this as completed in d93db33 Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants