Issue
- As a developer, I would like to use function
addModulein my custom portlet on DXP 7.2 the same way I did in case of 7.1 as well. - However, after deploy the following errors are shown in browser console:
TypeError: Liferay.Loader.addModule is not a function
and
Error: The following problems where detected while resolving modules: Missing required module '[...]'
Environment
- Liferay DXP 7.2
Resolution
-
The reason of getting the error messages is the fact
addModulefunction has been removed from DXP 7.2 by design. - The technical reasoning behind is the following new approach of handling modules: all module resolutions are aimed to be applied on the server side in order to boost speed and network performance. It also means no module shall be added on the client side because the server wouldn't know about them and wouldn't be able to resolve it.
-
Please provide a detailed description of the particular use case and elaborate what is desired to achieve exactly by using
addModule. - With all these additional information, Liferay Support may involve the Product Team and ask for suggesting a possible alternative method, if applicable.