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

nutkani1337's avatar

Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../"

I'm trying to upload my website on cPanel. The thing is, the website is working fine in the local environment. But when I uploaded the site on cPanel, I got the following error in my console/network tab (site is showing blank).

Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../". I'm not sure whether it is a path issue (as it's working fine on local environment before and after build)

Tech Stack

1- Laravel

2- Vuejs/Inertia Js with vite

Any suggestions or lead will be highly appreciated. Below is the directory structure of my local vs cPanel environment

0 likes
5 replies
jny986@gmail.com's avatar

I have come across this problem anytime that I try to add and use an alias to Vite. It will work some of the time and not others.

Sinnbeck's avatar

Show the code that is throwing the error

intrithm's avatar

@Sinnbeck facing the same problem

import laravel from "laravel-vite-plugin";
import vue from "@vitejs/plugin-vue";

export default defineConfig({
    plugins: [
        laravel({
            input: ["resources/sass/app.scss", "resources/js/app.js"],
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
    ],
    resolve: {
        alias: {
            vue: "vue/dist/vue.esm-bundler.js",
        },
    },
});
paulad's avatar

Hi folks, did anyone fins the solution to the error in topic? I'm running the same problem on vue with vite trying to deploy my app to gh pages.

martinbean's avatar

@paulad Create a new thread, with details and context related to your project, instead of bumping a dead thread that’s over a year old.

Please or to participate in this conversation.