Closed
Description
Given this controllers.json
(notice the lazy):
{
"controllers": {
"@symfony/ux-react": {
"react": {
"enabled": true,
"fetch": "lazy"
}
}
},
"entrypoints": []
}
The controller symfony--ux-react--react
itself will in fact load lazly:
The main problem is that every import inside alll React components is loaded on every page request, not only on the page that uses the symfony--ux-react--react
controller.
Take the following. It's a page that doesn't load the symfony--ux-react--react
at all. I've highlighted the network tab, where you can see that:
vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_symfony_ux-react_dist-2a274e.css
: which is used by myBusinessList.jsx
component (not loaded in this page)vendors-node_modules_mapbox-gl_dist_mapbox-gl_js.js
: used by myBusinessMap.jsx
component (not loaded in this page)
The question is: is this the intended behaviour of symfony/ux-react, or my fault, or maybe a bug?