Laravel mix versioning doesn't remove old built files

五迷三道 提交于 2019-12-08 04:40:53

问题


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?


回答1:


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.

  1. Let files go in default directories.

    js mix.js('./resources/assets/js/app.js', 'public/js/app.js')

  2. Tell npm to delete your bundle folder before building new

  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!