Laravel-mix: Support for VUE 3

Created on 17 Jul 2020  路  9Comments  路  Source: JeffreyWay/laravel-mix

When it is planned to include VUE 3 support ??

Most helpful comment

Support is in Mix v6.

All 9 comments

With vuejs 3 hitting RC status this has become a very welcome improvement.

Agreed. Like like to hear a proposed timeline as well.

Update?

Any update, please?

Is there any update of VUE 3 support?

Until support is added, you can use webpack directly:

// webpack.config.js

const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');

module.exports = (env = {}) => ({
    mode: env.prod ? 'production' : 'development',
    devtool: env.prod ? 'source-map' : 'eval-cheap-module-source-map',
    entry: [
        path.resolve(__dirname, './resources/js/app.ts'),
    ],
    output: {
        path: path.resolve(__dirname, './public/js'),
        filename: "app.js"
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './resources/js'),
        },
        extensions: ['.ts', '.js', '.vue'],
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                use: 'vue-loader'
            },
            {
                test: /\.ts$/,
                loader: 'ts-loader',
                options: {
                    appendTsSuffixTo: [/\.vue$/],
                }
            },
        ]
    },
    plugins: [
        new VueLoaderPlugin(),
    ],
});

Minimal Laravel config based on https://github.com/vuejs/vue-next-webpack-preview
Note this isn't transpiling for backwards compatibility.

Run with webpack or npx webpack

@mayanksdudakiya and @Masterbranch1 you can use temporary this package https://github.com/KABBOUCHI/laravel-mix-vue3 until the official support is out.

This solution also works for me:

https://stackoverflow.com/questions/63967346/install-vue-3-0-in-laravel/63994238#63994238

If you use inline template like i do then you have to switch to using slots since inline-template is deprecated.

Support is in Mix v6.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rderimay picture rderimay  路  3Comments

Bomavi picture Bomavi  路  3Comments

amin101 picture amin101  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

kpilard picture kpilard  路  3Comments