I try to use the versioning but no suffix is added to my assets. Note that I also tried to remove the condition so the version would occur at any compilation but it did not work either.
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.copyDirectory('resources/assets/images', 'public/images');
mix.version();
if (mix.inProduction()) {
mix.version();
}
Just install a fresh installation of Laravel 5.6 project with vue.js. Try to compile with the versioning.
@stereoptic Hi. I had same problem today.
Actually, it works fine.
Just make npm run prod and use {{ mix('/js/app.js') }}.
Identifier will be add automatically.
You can open source code of your page and check it.
<script src="/js/app.js?id=f0d5cf09099431849414"></script>
Laravel 5.6's mix works differently now. Instead of suffixing your compiled files with hashes, it now uses a url query in trying to access your assets.
Try opening your browser dev tools and look at how your page includes your assets. It will append an id param in the URL.
e.g. GET /js/app.js?id=<SOME_HASH_HERE>
Same issue, but not using Laravel. Using with a vue ssr web app, and no longer have versioned files (although reported that I do in the outputted vue-ssr-client-manifest.json).
I'm running npm 6.4.1 and cannot add mix.version() anywhere into my webpack.mix.js file because whenever I do I get the following error:
fs.js:660
return binding.open(pathModule.toNamespacedPath(path),
^
Error: ENOENT: no such file or directory, open '/public/themes/elvie-v1/css/elvie-v1.css'
Any ideas?
@mikerogerz It not will be work without laravel.
Now id of version generate laravel function mix.
It can work outside of Laravel, but you need to create a function that reads the mix-manifest.json file. That鈥檚 where the versioned filenames are located.
Not working for me too and I am not using laravel, too. The error is that no hashes are being generated for my js and css files, the files were already built by webpack and I just want to append the hashes to the files with laravel mix. the mix-manifest.json file is wrong too, the key and value are always the same in the file.
the mix-manifest.json file is wrong too, the key and value are always the same in the file.
Same issue for me.
@Cankar001 and @kerns how are you adding to files to webpack? I am asking because for me laravel mix versioning works just fine and I have used older and latest laravel mix versions. I also add js files using webpack config passed to laravel mix.
Most helpful comment
Laravel 5.6's mix works differently now. Instead of suffixing your compiled files with hashes, it now uses a url query in trying to access your assets.
Try opening your browser dev tools and look at how your page includes your assets. It will append an id param in the URL.
e.g.
GET /js/app.js?id=<SOME_HASH_HERE>