Issue
- Following Adapting Existing Apps to Run on Liferay DXP, after re-adapting a pure JS project (React, Angular, Vue) to become a Liferay JS widget with the
liferay-js:adapt
command, there will be noconfiguration.json
in the/features
folder and no way to access theconfiguration
variable insideindex.js
Environment
- Liferay DXP 7.1+
- Liferay JS Generator
Resolution
-
Using the
configuration
variable in a re-adapted JS app is not supported and won't be in the future. This is because the portlet bootstrapping process depends very much on the underlying framework and the JS Toolkit doesn't have control over it. As a result, it is not possible for the tool to guarantee support for reliably accessing theconfiguration
. -
Furthermore,
liferay-js:adapt
is intended as a way to run JS code that is not Liferay specific. When Liferay features are needed, it is recommended to switch to non-adapted projects (i.e., developing the project from scratch withyo liferay-js
) instead of using the frameworks' development tools. These may trigger inconsistencies, given that they are designed with a SPA in mind rather than a Liferay portlet.