Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

danasg's avatar

danasg liked a comment+100 XP

3mos ago

It's really not a problem to capitalize the names of the views, but I don't know the reason why it's like this.

You can safely use non capitalized names, but you need to do change some things in your code.

createInertiaApp({
    id: 'custom_id',
    resolve: name => {
        const pages = import.meta.glob('./pages/**/*.vue', { eager: true }); // here pages in lowercase

        const page = pages[`./pages/${name}.vue`]; // here pages in lowercase
        
        page.default.layout = page.default.layout || Layout;

        return page;
    },
    setup({ el, App, props, plugin }) {
        const app = createApp({ render: () => h(App, props) });

        app.use(plugin);

        app.mount(el);
    },
});

And for tests to be working, you also have to publish the inertia.php configuration file and change these lines.

'page_paths' => [

    resource_path('js/pages'), // here pages in lowercase

],

'testing' => [

    'ensure_pages_exist' => true,

    'page_paths' => [

        resource_path('js/pages'), // here pages in lowercase

    ],

    'page_extensions' => [

        'js',
        'jsx',
        'svelte',
        'ts',
        'tsx',
        'vue',

    ],

],
danasg's avatar

danasg started a new conversation+100 XP

3mos ago

Hello. Is there any specific reason for capitalizing the names of vue page files, i.e. Index, Create, Show etc instead of index, create and show. I can accept that the components themselves are capitalized but capitalizing these traditionally "route pages" can cause issues (and did) when I was testing my solution with nuxt/vue which recommends that route pages are not capitalized. Then I landed in a problem once I removed the capitalization and got deployment server errors which turned out to be du to linux being case-sensitive, windows not case sensitive, git on windows did not update the casing in the repo. Another problem I landed in was the file-based routing with pure vue application, that does not accept capitals for route files. After these ordeals, it is my opinion that it is much safer to just have the traditional route vue files (in the pages dirrectory) without capitalization - removed all these risks. About using the same code in nuxt, I only minor modifications of Inertia specifics which I fixed with "conditionals" (nuxtApp: true vs. false) for routing etc and it now works in both. MY QUESTION is whether there is any down sides of not capitalizing these route files in the laravle-inertia-vue framework? Any other opinions on this?