JoaoHamerski's avatar

How to run webpack server in Laravel Mix? (without Laravel)

I'm using only laravel-mix on stand alone project https://laravel-mix.com/

But i cant figure out how do i config laravel-mix to run a server on my localhost

i tried npx mix watch --hot but when i go to http://localhost:8080/

i get this message: Cannot GET / even if i try to get the path to my bundle.js. Every URL returns me this error.

0 likes
1 reply
JoaoHamerski's avatar

I just figured out what was wrong:

mix.js('src/app.js', 'dist').setPublicPath('dist/')
  .react();

I setted the publicPath to dist/ instead of public/ so webpack was looking my index.html inside my dist/ when it was inside my public/ folder, to fix it i just changed the setPublicPath to the folder where my index.html was.

Please or to participate in this conversation.