Categories
General Laravel

Laravel – Versionning your app.js

LIFE SAVER for frontend beginner developer!

Laravel – Versionning your app.js to cache bust for deploying

1 – Modify following file webpack.mix.js

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

mix.version();

2 – Modify your blade

<script src="{{ env('APP_URL') }}{{ mix('js/app.js') }}"></script>

3 – you will see the following generation

<script src="https://xxxxx.raleche.com.test/js/app.js?id=a8305a8c81a6359c3c7b"></script>