So i'm just about ready to deploy my app, files and everything is on the prod server, running 'npm run prod'
However, it doesn't seem to make much different from the development command result wise, i would expected some minification at least . I do not use the crappy webpack and i wish to god laravel would've still been using elixir and gulp but..
so here's the mix js file:
https://paste.laravel.io/b03d0acc-a16e-4c65-88b2-0bb5e5fb3bf2#
so, basically there's no meaning to the run prod or dev in my case?
should i specifically use the minify command? this would screw my git setup somewhat.
So Laravel mix will automatically minify everything you when you run in production mode, however you are not using that anymore so you don't get that extra stuff! So yes you need to minify it yourself now!
However I hear you say something about screwing Git up. The process with assets like this should be development locally and compiling on the server. This way you don't have everything in your repository and you won't have merge conflicts with all the compiled files all the time. This also means you need to run node and npm on your server of course.
If you don't do this you will always need to compile your edits in production mode, push that and deploy.
"The process with assets like this should be development locally and compiling on the server. This way you don't have everything in your repository and you won't have merge conflicts with all the compiled files all the time. This also means you need to run node and npm on your server of course."
I would rather not used a deprecated software with no future support and updates.
"Any reason why Laravel Mix is nothing for you?"
Well, Elixir was really easy to handle, this whole webpack thing, i never got it to actually work for me, no matter how much i read about it, couldn't get it to work.
Well you develop your application locally but everytime you compile your assets they will be written to your public directory so you can use them in your application. Now the thing is that you will commit these changes as well everytime you push your application. This means that when you work together with someone for example the assets will already be compiled and the other won't have to compile them to have a working product. However if that other person makes a change assets will be compiled again and you have a new commit with multiple changes. The assets itself and the compiled assets. Now when you don't commit these compiled files, you will never have merge conflicts or a lot of files to commit, because you only commit the real assets and not the compiled onces. Your server should than compile your assets. This compiling should be done during the deployment for example. Now if you work alone on a project you're fine, but if you work with others this can improve the project a lot. Is that clear?
Fair enough.
Well the mix thing itself isn't that hard at all. However when you want custom stuff it will get interesting and indeed you have a huge learning curve! I'm not an expert to be honest but I would still recommend to use Laravel Mix in the end ;)
yeah, its quite clear, so basically i should add the public assests dir to the gitignore file and compile at production.
BUT i do want to have the files minified at production, and i can't have a different webpack.mix.js because this would break the git workflow unless i ignore it too but then i'll have to modify it at prod everytime i have some new assets added. if there was a way to specify at webpack.mix.js some condition like
if (env=='production') minify()...
it would be great option.
turns out i have no need for webpack since i only use vanila JS.
also the mix documentation states:
"Similar to combining stylesheets with mix.styles(), you may also combine and minify any number of JavaScript files with the scripts() method:"