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

theUnforgiven's avatar

Moving from Webpack to Vite

Having followed the upgrade guide from Laravel

My app.js file looks like:

import './bootstrap';
import '../css/app.css';

import store from './store/index'
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';
import moment from "moment";

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(ZiggyVue)
            .use(store)
            .use(moment)
            .mount(el);
    },
    progress: {
        color: '#4B5563',
    },
});

But upon going to the site I'm getting: RangeError: Maximum call stack size exceeded at Proxy.hasOwnProperty (<anonymous>) Which is pointing to createInertiaApp({ within the app.js

Vite is running on npm run dev without any errors, and also managed to do npm run build without errors.

What could this error be in relation to and how can I overcome it?

0 likes
3 replies
LaryAI's avatar
Level 58

The error "RangeError: Maximum call stack size exceeded at Proxy.hasOwnProperty" typically occurs when there is a circular reference or infinite loop in your code. In this case, it seems to be related to the usage of the createInertiaApp function.

To overcome this error, you can try the following steps:

  1. Make sure you have installed the necessary dependencies for Vite and Inertia.js. You can do this by running npm install vite @inertiajs/inertia @inertiajs/inertia-vue3 in your project directory.

  2. Update your app.js file to use the createApp function from Vite instead of the createInertiaApp function. Here's an example of how you can modify your code:

import './bootstrap';
import '../css/app.css';

import store from './store/index'
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';
import moment from "moment";

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createApp({
    render: () => h(createInertiaApp, {
        title: (title) => `${title} - ${appName}`,
        resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
        setup({ el, App, props, plugin }) {
            return createApp({ render: () => h(App, props) })
                .use(plugin)
                .use(ZiggyVue)
                .use(store)
                .use(moment)
                .mount(el);
        },
        progress: {
            color: '#4B5563',
        },
    })
}).mount('#app');
  1. After making these changes, run npm run dev to start the development server and see if the error is resolved.

If you're still experiencing issues, it's possible that there might be other factors causing the error. In that case, it would be helpful to provide more information about your project setup and any additional error messages you're encountering.

Libbygallagher's avatar

Hello,Update Dependencies: Make sure all your dependencies, especially InertiaJS, Vue, and Laravel-Vite, are up-to-date. Older versions may contain bugs that have been fixed in newer releases. Check for Circular Dependencies: Look for any potential circular dependencies in your codebase. These are instances where module A depends on module B and module B also (directly or indirectly) depends on module A. Moment Usage: It's unusual to use moment as a Vue plugin with .use(moment). Moment.js isn't a Vue plugin and isn't designed to work this way. You typically import it in the files where it's needed. Debugging: Try commenting out the various .use() statements to isolate the problem. If the error disappears after commenting out a particular line, you'll have found the source of the problem. https://www.mythdhr.ltd/

theUnforgiven's avatar

Yeah, that's what I've been doing but seems it's something else, so having to go through everything and see what it could be.

Please or to participate in this conversation.