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

intrithm's avatar

Failed to resolve module Vue

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

my viteconfig

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",
        },
    },
});
0 likes
6 replies
gych's avatar

Do you get the same error when you remove this from resolve alias in app.js ?

 vue: "vue/dist/vue.esm-bundler.js",
intrithm's avatar

@martinbean yeah yes i have installed Vue, if i click on vue or createApp from my editor it is opening the path properly.So i guess it is with vite , Also if i make changes in app.js it is not autorefreshing the site.

MaverickChan's avatar
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue'

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
        vue()
    ],
});

just like that

intrithm's avatar

Incase someone has the same issue,it may be helpfull , I made a silly mistake 😒and added / in the asset binding my code looked like this

@vite(['/resources/css/app.css', '/resources/js/app.js']) //wrong

I changed like below and it worked

@vite(['resources/css/app.css', 'resources/js/app.js'])

Please or to participate in this conversation.