vuetify-loader 1.6 is incompatible with laravel mix, vue-loader 15 currently does not support vue rules with oneOf
Asked Answered
N

3

2

I'm trying to install the vue on the laravel. I believe I got it, but when I run the npm run watch or npm run dev, it generates this error. I've tried several things and I can't solve

Error: [VueLoaderPlugin Error] vue-loader 15 currently does not support vue rules with oneOf.
    at VueLoaderPlugin.apply (C:\laravel\construtora2\node_modules\vue-loader\lib\plugin-webpack4.js:46:13)
    at webpack (C:\laravel\construtora2\node_modules\webpack\lib\webpack.js:51:13)
    at processOptions (C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:272:16)
    at C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:364:3
    at Object.parse (C:\laravel\construtora2\node_modules\webpack-cli\node_modules\yargs\yargs.js:576:18)
    at C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:49:8
    at Object.<anonymous> (C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\laravel\construtora2\node_modules\webpack\bin\webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Gabriel\AppData\Roaming\npm-cache\_logs\2020-08-04T21_40_34_083Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Gabriel\AppData\Roaming\npm-cache\_logs\2020-08-04T21_40_34_137Z-debug.log

File: webpack.mix.js

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

const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');
var webpackConfig = {
        plugins: [
            new VuetifyLoaderPlugin()
            // other plugins ...
        ]
    // other webpack config ...
}
mix.webpackConfig(webpackConfig);
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

Someone help me please

Natale answered 4/8, 2020 at 21:47 Comment(4)
are you using vuetify? can you share your mix.config file?Pascasia
i'm using laravel and i didn't find this file. It would be the webpack.mix.jsNatale
yes, sorry, that's what I mean, can you share that file as well?Pascasia
ready, i already addedNatale
P
6

Right so you are using Vuetify this is because vuetify-loader 1.6 has some problems with laravel mix setup. More specifically it's because the order of vue-loader and vuetify-loader was added by laravel-mix.

For now you need to add VuetifyLoaderPlugin after laravel-mix compiles all the plugins.

So remove the new VuetifyLoaderPlugin() from var webpackConfig variable. And add new VuetifyLoaderPlugin() after every plugin is added.

mix.extend('vuetify', new class {
    webpackConfig (config) {
        config.plugins.push(new VuetifyLoaderPlugin())
    }
})
mix.vuetify()

If everything is overwhelming to you, I have a small library that does everything for you.

All you need to do is to install it

npm i vuetifyjs-mix-extension -D

require it

require('vuetifyjs-mix-extension')

use it

mix.js('resources/js/app.js', 'public/js').vuetify('vuetify-loader')

Those two approaches should do the same thing for you. You can choose on your preference.

Pascasia answered 4/8, 2020 at 22:33 Comment(3)
Do I delete the entire code for the variable and mix.webpackcongig, and add this code?Natale
@GobsRuiz no you only delete new VuetifyLoaderPlugin() within the plugin array from your var webpackConfig variable.Pascasia
I removed everything and added the code you entered. I just kept the variable that is importing the vuetify-loader and it worked.Natale
M
2

Try to downgrade vuetify-loader to an older version

npm i [email protected]
Mistress answered 7/12, 2020 at 16:16 Comment(0)
G
0

It helps me. Change from

const VueLoaderPlugin = require('vue-loader');

to

const {VueLoaderPlugin} = require('vue-loader');
Gere answered 4/6, 2022 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.