Laravel-mix: mix() function doesn't include version()-ed files

Created on 14 Feb 2018  路  4Comments  路  Source: JeffreyWay/laravel-mix

Hey guys,

I'm having the problem that I can't include any file that is listed in the created mix-manifest.json.

So, first I included the file in my welcome.blade.php like that:
<link rel="stylesheet" href="{{ mix('css/app.css') }}">

Next I updated the webpack.mix.js file:
let mix = require('laravel-mix'); mix. js('resources/assets/js/app.js', 'js') .sass('resources/assets/sass/app.scss', 'css') .version(); mix.browserSync('localhost/myfancyapplication/public');

Afterwards I started all that with
npm run watch

The browser tries to reload the affected files on change, but unfortunately it can't get them included properly because of an obvious path problem in mix-manifest.json.

The above mix() function resulted in
<link rel="stylesheet" href="/css/app.css?id=999cc6dd8c94da46b208">

I get a 404: http://localhost:3000/css/app.css?id=999cc6dd8c94da46b208

If I edit the link tag by myself, of course it will include the requested file properly:
<link rel="stylesheet" href="css/app.css?id=999cc6dd8c94da46b208">

=> http://localhost:3000/myfancyapplication/public/css/app.css?id=999cc6dd8c94da46b208

Notice: To view that site I browse - as you might think - http://localhost:3000/myfancywebsite/public/

What do I do wrong?

Thanks in advance,
Kind regards!

Most helpful comment

This seems more like a laravel issue, as the helper method is not included in laravel-mix. Does wrapping your mix call in the asset() helper fix your problem?

<link rel="stylesheet" href="{{ asset(mix('css/app.css')) }}">

All 4 comments

This seems more like a laravel issue, as the helper method is not included in laravel-mix. Does wrapping your mix call in the asset() helper fix your problem?

<link rel="stylesheet" href="{{ asset(mix('css/app.css')) }}">

it solves the problem thank you! (at least form me)

It works like a charm thanks!

It solved my problem too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nezaboravi picture nezaboravi  路  3Comments

wendt88 picture wendt88  路  3Comments

mementoneli picture mementoneli  路  3Comments

dtheb picture dtheb  路  3Comments

mstralka picture mstralka  路  3Comments