Closed mrtipsytony closed 4 months ago
Is there a way I can prevent that and make sure only load it once?
It should only load it once. Once a module is fetched from the server and processed by Liferay.Loader
it is stored in memory and never fetched or parsed again until the page is refreshed.
Otherwise modules wouldn't be able to have internal state (internal vars) and no stateful module would work.
Currently loads the same ES module many times if checked in Network logs
Can we see those logs? Are these loads for the same page or do they happen after a page reload? Because if it happens after a page reload then what you are seeing is a cache failure, not an issue from the AMD loader.
Meaning that, depending on your DXP server settings, it can be a feature (for example, you definitely want to fetch the JS files every time you access them when you are developing) or an issue (you probably want to cache JS files in production until they change).
Issue type (mark with
x
)Description
I just have a question. I have portlets that is loading the same ES module (through Liferay.loader.require or aui:script require) many times. Is there a way I can prevent that and make sure only load it once?
Desired behavior: Load the same ES module once since it's shared by multiple portlets
Current behavior: Currently loads the same ES module many times if checked in Network logs
Repro instructions (if applicable):
Other information (environment, versions etc):