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

stacker's avatar

Two files with same name - how does Inertia know which one to render?

I installed Jetstream and I can see the in the web.php route file it points to the Welcome vue page.

Route::get('/', function () {
    return Inertia::render('Welcome', [
        'canLogin' => Route::has('login'),
        'canRegister' => Route::has('register'),
        'laravelVersion' => Application::VERSION,
        'phpVersion' => PHP_VERSION,
    ]);
});

But Jetstream created two Welcome.vue files: One in the resources/js/Jetstream folder and one in the resources/Pages folder. Where is it defined?

Thanks

0 likes
1 reply
matty-p's avatar
matty-p
Best Answer
Level 1

If you look in /resources/js/app.js you can find the following statement (for me its line 19):

resolveComponent: (name) => require('./Pages/${name}').default,

By default, when you tell Inertia to render a component, it will look in the /resources/js/Pages directory for a component matching the name provided in the Inertia::render() statement.

So, to answer your question, the component being referenced by this route is /resources/js/Pages/Welcome.vue.

1 like

Please or to participate in this conversation.