Garmaine Staff asked 1 year ago

I am using ZF3 MVC and I want to also use Webpack to bundle and manage dependencies in my frontend Javascript.

I looked at this excellent answer to a similar question but it does not address specifically ZF3 MVC apps.

In my app, some pages have AngularJS fontends, some have React (I am transitioning to React) and most have at least Bootstrap. And the pages that have more extensive frontends, also require packages like TinyMCE.

Since not all the rendered pages of a ZF3 application need the same frontend JS, how do you create multiple bundles so that each rendered page can have its own bundle of scripts?

It would not be efficient to have "one size fits all" frontend that loads everything that you would ever need in your frontend.

How do you easily keep track of which bundles needs to be loaded by which view template?