When compiling assets for Netlify, I not only need all the resources in _assets and assets to be copied, but also _redirect on the root level, which has to go to build_production/_redirects (only when npm run production of course.
I know that I can use mix.copy('_redirects', 'build_production/_redirects'); but I neither know whether that would be the right way to do, nor where to put it in the Laravel Mix/webpack config system.
If you only want to copy the files when running npm run production, you can do something like this:
if (mix.inProduction()) {
mix.copy('_redirects', 'build_production/_redirects');
}
@minthemiddle Another solution is to store your redirects in a netlify.toml config file, as mentioned here.
Most helpful comment
@minthemiddle Another solution is to store your redirects in a
netlify.tomlconfig file, as mentioned here.