[Vuejs]-How to have multiple Vue projects in one laravel project

1๐Ÿ‘

I did this recently in a project where i created resources/backend/js and resources/frontend/js where i wanted the output to be in public/frontend and public/backend. I stumbled on some issues with the manifest file but got it working in the end.

You can do this by creating a new frontend.mix.js and change the output paths to

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

mix.setPublicPath('public/frontend')
    .setResourceRoot('/frontend')

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

You will need to create a few new command to use frontend.mix.js

"scripts": {
    "frontend-dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --env.mixfile=frontend.mix --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "frontend-watch": "npm run frontend-dev -- --watch",
}

Inside the original webpack.mix.js file i changed the paths to backend and left the commands untouched.

Hope this helps you.

๐Ÿ‘คRobbin Benard

Leave a comment