How to autoload vue3 components in combination with Laravel Mix (using the plugin "unplugin-vue-components")?

Viewed 258

I would very much like to use the vue plugin "unplugin-vue-components" to autoload vue3 components, but i unfortunately don't seem to get it to work using Laravel Mix.

Mix doesn't produce an error, but i can't autoload the components either.

Webpack.mix.js:

const mix = require('laravel-mix');
const Components = require('unplugin-vue-components/webpack');

mix.webpackConfig({
    plugins: [
        Components({
            dirs: ['./resources/js/components']
        })
    ]
});

mix.js('resources/js/main.js', 'public/js').vue();

main.js:

import { createApp } from 'vue';
import BalmUI from 'balm-ui'; 
import BalmUIPlus from 'balm-ui/dist/balm-ui-plus'; 

const app = createApp({});

app.use(BalmUI);
app.use(BalmUIPlus);

app.mount('#app');

Expected behaviour is that a vue3 component (e.g. ./resources/js/components/RecoverPassword) would be imported & initialized automatically.

Importing & initializing individual components does work.

Hope anyone can help.

0 Answers
Related