stevenh's avatar

Can't get Vuetify 2 to work with Laravel

Hi,

I haven't been able to get the new version of Vuetify (which has components à-la-carte) to work with Laravel.

The problem is related to not using Vue CLI 3. From the Vuetify documentation:

"If there is a reason you are unable to utilize the Vue CLI 3 package, you can manually install the vuetify-loader through your vue.config.js or webpack config."

"Vuetify loader - Keeping track of all the components you're using can be a real chore. The vuetify-loader alleviates this pain by automatically importing all the Vuetify components you use, where you use them. This will also make code-splitting more effective, as webpack will only load the components required for that chunk to be displayed."

"Webpack installation - You can also explicitly install the loader for webpack based projects. Similar to the vue.config.js setup, you simply add the loader to your project's webpack plugins."

// webpack.config.js

const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')

module.exports = {
  plugins: [
    new VuetifyLoaderPlugin()
  ],
}

How do I use this code in webpack.mix.js?

0 likes
3 replies
stevenh's avatar

I have tried changing APP_ENV to "production" and have changed webpack.mix.js as follows with no luck:

const mix = require('laravel-mix');

//MYCODE
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')

    //MYCODE
    .webpackConfig(webpack => {
      return {
          plugins: [
            new VuetifyLoaderPlugin()
          ]
      };
    });

I just get the following error:


/vuetifyapp/node_modules/webpack-cli/bin/cli.js:93
                                throw err;
                                ^

Error: Cannot find module 'vuetify-loader/lib/plugin'

wolverine4277's avatar

Hi stevenh, maybe you already figure out which was your problem, but if not i have the same error and solved installing vuetify-loader:

npm install vuetify-loader -D ​

Now trying without luck that the components render ok, some misconfiguration maybe...

Toluay's avatar

Vuetify still not working on laravel can someone help urgent

Please or to participate in this conversation.