Skip to content

Laravel 6 Mix errors #17

@likemusic

Description

@likemusic

When added to webpack.mix.js (according to #4 ):

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: ['vue-inheritance-loader']
            }
        ]
    }
});

this error happens:

root@likemusic:~/ea# docker-compose run --rm node yarn watch
yarn run v1.22.4
$ npm run development -- --watch
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1606504130646-0.5953826234112498/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> @ development /var/www
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

/var/www/node_modules/webpack-cli/bin/cli.js:281
                                throw err;
                                ^

Error: [VueLoaderPlugin Error] No matching use for vue-loader is found.
Make sure the rule matching .vue files include vue-loader in its use.
    at VueLoaderPlugin.apply (/var/www/node_modules/vue-loader/lib/plugin-webpack4.js:59:13)
    at webpack (/var/www/node_modules/webpack/lib/webpack.js:51:13)
    at processOptions (/var/www/node_modules/webpack-cli/bin/cli.js:272:16)
    at /var/www/node_modules/webpack-cli/bin/cli.js:364:3
    at Object.parse (/var/www/node_modules/yargs/yargs.js:576:18)
    at /var/www/node_modules/webpack-cli/bin/cli.js:49:8
    at Object.<anonymous> (/var/www/node_modules/webpack-cli/bin/cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875:14)
    at Module.require (internal/modules/cjs/loader.js:1022:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/var/www/node_modules/webpack/bin/webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:1118:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875: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 "--watch"`
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!     /root/.npm/_logs/2020-11-27T19_08_55_120Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

As I understand, this is because standard vue-loader still used. Threrefore I have tried to replace in node_modules/laravel-mix/src/components/Vue.js this:

    webpackConfig(webpackConfig) {
        webpackConfig.module.rules.push({
            test: /\.vue$/,
            use: [
                {
                    loader: 'vue-loader',
                    options: Config.vue || {}
                }
            ]
        });

        webpackConfig.plugins.push(new VueLoaderPlugin());

        this.updateCssLoaders(webpackConfig);
    }

with that:

    webpackConfig(webpackConfig) {
        webpackConfig.module.rules.push({
            test: /\.vue$/,
            use: [
                {
                    loader: 'vue-inheritance-loader',
                    options: Config.vue || {}
                }
            ]
        });

//        webpackConfig.plugins.push(new VueLoaderPlugin());

        this.updateCssLoaders(webpackConfig);

I've got many errors like this:

ERROR in ./resources/js/Domain/Common/Controls/Button/ButtonCreate.vue 1:0
Module parse failed: Unexpected token (1:0)
File was processed with these loaders:
 * ./node_modules/vue-inheritance-loader/src/index.js
You may need an additional loader to handle the result of these loaders.
> <script>
|     import BaseBootstrapButtonInfo from "../Base/BootstrapButton/BaseBootstrapButtonInfo";
|
 @ ./resources/js/app.js 47:31-86
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./resources/js/Domain/Invoices/ExpenseConformities/Dkv/DkvExpenseConformityForm.vue 1:0
Module parse failed: Unexpected token (1:0)
File was processed with these loaders:
 * ./node_modules/vue-inheritance-loader/src/index.js
You may need an additional loader to handle the result of these loaders.
> <script>
|     import BaseExpenseConformityForm from "../Base/BaseExpenseConformityForm";
|
 @ ./resources/js/app.js 137:45-122
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./resources/js/Domain/Invoices/ExpenseConformities/Bank/BankExpenseConformityForm.vue 1:0
Module parse failed: Unexpected token (1:0)
File was processed with these loaders:
 * ./node_modules/vue-inheritance-loader/src/index.js
You may need an additional loader to handle the result of these loaders.
> <script>
|     import BaseExpenseConformityForm from "../Base/BaseExpenseConformityForm";
|
 @ ./resources/js/app.js 140:46-125
 @ multi ./resources/js/app.js ./resources/sass/app.scss

Any ideas how to fix? Does anyone use this package with laravel mix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions