What are loaders (view->makeLoader()) and why are they needed?


I have an application (Wordpress-based) running on WPEngine, a host with notoriously strict security policies that, amongst other things, prevent the web server from writing files. The known workaround for this with Sage is to pre-compile all Blade templates after each deployment. This has worked for me in the past, however in this case I am using Woocommerce via generoi/sage-woocommerce, which makes uses of “loaders”. Would somebody be able to explain why it is necessary to include a “loader”, rather than including the compiled view directly itself?

I have written a helper command to “pre-compile” these loaders too, but it doesn’t work because the id/hash in the filename seems to be different on the server so it ends up trying to rebuild them on the fly anyway.


1 Like