Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-84977

The npm portlet extender is not initializing the JS module when it is directly exported (without "default")

    Details

      Description

      Currently the npm portlet extender is invoking the main JS module of the managed JAR indexing its "default" property. That's OK for JS modules written in ES2015+, but fails for raw JS modules that directly export a function like this:

          module.exports = function(args) { ... }

      We could argue that the users should export the function as a "default" property, but the dev experience would be degraded, so it's better to handle it in the portal for the sake of human wellness.

       

      Steps to reproduce:

      1. Start portal
      2. Deploy attached JAR file
      3. Add a "test" portlet (can be found under "Sample" category)

      Expected results:

      1. Portlet renders correctly

      Actual results:

      1. Portlet fails to render and an error is dump in the JS console

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 1 week, 1 day ago

                Packages

                Version Package
                7.1.X
                Master