Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

claudios's avatar

Vuejs 2 + Laravel mix without a Laravel Project

Hi, been searching around the web on a guide or steps to create a vue project with laravel mix but without using the core laravel.

I found a simple tut here for vue and installed laravel mix.

I changed the scripts inside my package.json to match with the laravel-mix scripts and when I run npm run dev, sass files are compiling but the main.js where vue was initialized is not compiling. No errors in the console actually.

Can anyone had this issue before or had a better tut so that I can follow? thanks in advance!

0 likes
2 replies
bobbybouwmann's avatar

Well the thing I did to get this work was getting the basic Vue setup from the Laravel repository and just add laravel-mix. You can also override a lot of places, for example

// webpack.mix.js

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

let LiveReloadPlugin = require('webpack-livereload-plugin');

mix.webpackConfig({
  plugins: [
    new LiveReloadPlugin()
  ]
});

mix.options({
  extractVueStyles: true
});

mix.setPublicPath('../web')
  .js('js/app.js', 'main.js')
  .sass('sass/app.scss', 'main.css');

If you set the public path you're free to load any file you want from that directory ;)

topvillas's avatar

Yep, setting the public path should sort out your problem.

I struggled with the production script though, it just hangs. Never found a solution to it.

Please or to participate in this conversation.