I am using Laravel 5.4 with mix to version my javascript and scss files.
The problem is: it doesn't clean the previous built files and simply add a new one with a different file name i.e. app.9d3e179e85922aad6ccf.js
In a new project I started, I do not have this issue. Mix correctly replaces the old file with the latest built version.
Is there somewhere where I can make the change?
This is an issue with the laravel-mix library which can't be addressed here. There are many open issues on GitHub referring to the same problem. You can check the most recent one for some workarounds till the official library gets a permanent fix.
https://github.com/JeffreyWay/laravel-mix/issues/814
Possible solutions in case the link doesn't work in the future.
There are few possible solution for now.
Let files go in default directories.
js mix.js('./resources/assets/js/app.js', 'public/js/app.js')
Tell npm to delete your bundle folder before building new
- Use the
clean-webpack-plugin
package https://github.com/johnagan/clean-webpack-plugin
来源:https://stackoverflow.com/questions/44353166/laravel-mix-versioning-doesnt-remove-old-built-files